Last active
August 8, 2017 20:53
-
-
Save yury-sannikov/90ca7124af86ffefd8e40d3c514dc6e4 to your computer and use it in GitHub Desktop.
mocha-aura timeouts
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
let clock; | |
before(function() { | |
clock = sinon.useFakeTimers(); | |
}); | |
describe('Create Component', function() { | |
it('should create component after timeout of 500 ms', function() { | |
// Make helper call which uses setTimeout(..., 500) to call GlobalHelper.showLoadedData() | |
helper.createComponent(); | |
// Check that showLoadedData not called yet | |
expect(global.GlobalHelper.showLoadedData).not.to.have.been.called; | |
// Emulate 501ms has been elapsed and showLoadedData have been called in synchronous manner | |
clock.tick(501); | |
expect(global.GlobalHelper.showLoadedData).to.have.been.calledWith(component); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment