Created
July 12, 2017 01:54
-
-
Save khaosdoctor/b697888e2dbad1948cecc717ed18cfb4 to your computer and use it in GitHub Desktop.
Stub example
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('Exemplo de stub com Sinon', (assert) => { | |
var message = 'an example message'; | |
var stub = sinon.stub().throws(); | |
var spy1 = sinon.spy(); | |
var spy2 = sinon.spy(); | |
PubSub.subscribe(message, stub); | |
PubSub.subscribe(message, spy1); | |
PubSub.subscribe(message, spy2); | |
PubSub.publishSync(message, undefined); | |
assert(spy1.called); | |
assert(spy2.called); | |
assert(stub.calledBefore(spy1)); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment