mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Cleaned up location of test files
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
describe('Custom Filters', function() {
|
||||
var filter
|
||||
, orderBySpy = sinon.spy();
|
||||
|
||||
beforeEach(function() {
|
||||
module(function($provide) {
|
||||
$provide.value('orderByFilter', orderBySpy);
|
||||
});
|
||||
inject(function($rootScope, $filter) {
|
||||
filter = $filter;
|
||||
});
|
||||
});
|
||||
|
||||
describe('conditionalOrderBy', function() {
|
||||
describe('when the predicate is true', function() {
|
||||
it('delegates the arguments to the orderBy filter', function() {
|
||||
filter('conditionalOrderBy')('array', true, 'sortPredicate', 'reverseOrder');
|
||||
expect(orderBySpy).to.have.been.calledWith('array','sortPredicate','reverseOrder');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the predicate is false', function() {
|
||||
it('returns the initial array', function() {
|
||||
expect(filter('conditionalOrderBy')([1,2,3], false)).to.eql([1,2,3]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('filterByTextAndNotes', function () {
|
||||
it('returns undefined when no input given', function () {
|
||||
expect(filter('filterByTextAndNotes')()).to.eql(undefined);
|
||||
});
|
||||
|
||||
it('returns input if term is not a string', function () {
|
||||
var input = [1, 2, 3];
|
||||
expect(filter('filterByTextAndNotes')(input, '')).to.eql(input);
|
||||
expect(filter('filterByTextAndNotes')(input, undefined)).to.eql(input);
|
||||
expect(filter('filterByTextAndNotes')(input, [])).to.eql(input);
|
||||
expect(filter('filterByTextAndNotes')(input, new Date())).to.eql(input);
|
||||
});
|
||||
|
||||
it('filters items by notes and text', function () {
|
||||
var tasks = [
|
||||
{ text: 'foo' },
|
||||
{ text: 'foo', notes: 'bar' }
|
||||
];
|
||||
|
||||
expect(filter('filterByTextAndNotes')(tasks, 'bar')).to.eql([tasks[1]]);
|
||||
expect(filter('filterByTextAndNotes')(tasks, 'foo')).to.eql([tasks[0], tasks[1]]);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user