Skip to content

Instantly share code, notes, and snippets.

@dperrymorrow
Last active August 14, 2017 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dperrymorrow/2955d384a692c2e163bda55c13e36fad to your computer and use it in GitHub Desktop.
Save dperrymorrow/2955d384a692c2e163bda55c13e36fad to your computer and use it in GitHub Desktop.
stubbing @welocalize/pantheon-api-sdk
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