Last active
August 14, 2017 23:30
-
-
Save dperrymorrow/2955d384a692c2e163bda55c13e36fad to your computer and use it in GitHub Desktop.
stubbing @welocalize/pantheon-api-sdk
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
const test = require("ava"); | |
const sinon = require("sinon"); | |
const SDK = require("@welocalize/pantheon-api-sdk"); | |
const getJwt = sinon.stub(SDK, "getJwt"); | |
test("stubbing a success of getJwt", t => { | |
const payload = { data: "foobar" }; | |
getJwt.returns(Promises.resolve(payload)); | |
}); | |
test("stubbing a failure of getJwt", t => { | |
getJwt.returns(Promises.reject({ message: "failure" })); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment