Created
October 22, 2013 13:46
-
-
Save ynonp/7101081 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var assert = chai.assert; | |
describe('Sinon', function() { | |
describe('spies', function() { | |
it('should keep count', function() { | |
// fill code here | |
spy(); | |
spy(); | |
spy(); | |
assert.equal( spy.callCount, 3 ); | |
}); | |
it('should spy on existing code', function() { | |
var arr = [10, 20, 30]; | |
// fill code here | |
arr.push( 40 ); | |
assert.isTrue( spy.calledOnce ); | |
}); | |
it('should stop spying when done', function() { | |
var arr = [10, 20, 30]; | |
// fill code here | |
arr.push( 40 ); | |
assert.isTrue( spy.calledOnce ); | |
// fill code here | |
arr.push(50); | |
assert.isTrue( spy.calledOnce ); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment