Created
February 23, 2016 20:44
-
-
Save giovanettid/d3b9e7bbee935bff9635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Todos', function() { | |
var Todo = requirejs('models/todo'); | |
var todos = requirejs('collections/todos'); | |
beforeEach(function() { | |
todos.reset(); | |
}); | |
it('filtering completed', function() { | |
todos.set([{title: 'todo1', completed: true}, {title: 'todo2', completed: false}, {completed: true}]); | |
var todosCompleted = todos.completed(); | |
expect(todosCompleted).to.have.length(2); | |
expect(todosCompleted[0].get('completed')).to.be.true; | |
expect(todosCompleted[1].get('completed')).to.be.true; | |
}); | |
it('filtering remaining', function() { | |
var todo1 = new Todo(); | |
todo1.toggle(); | |
var todo2 = new Todo(); | |
todos.set([todo1, todo2]); | |
var todosRemaining = todos.remaining(); | |
expect(todosRemaining).to.have.length(1); | |
expect(todosRemaining[0]).to.eql(todo2); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment