Last active
August 29, 2015 14:09
-
-
Save r01010010/97284164f162652e8d60 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 sinon = require('sinon'); | |
var chai = require('chai'); | |
expect = chai.expect; | |
should = chai.should(); | |
assert = chai.assert; | |
var clock; | |
beforeEach(function () { | |
clock = sinon.useFakeTimers(); | |
}); | |
afterEach(function () { | |
clock.restore(); | |
}); | |
it("should time out after 5000 ms", function() { | |
var timedOut = false; | |
setTimeout(function () { | |
console.log('executed!'); | |
timedOut = true; | |
}, 5000); | |
timedOut.should.be.false; | |
clock.tick(5500); | |
timedOut.should.be.true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment