Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mearns/7981a2a277821e1ab1904ececbaf0fdf to your computer and use it in GitHub Desktop.
Save mearns/7981a2a277821e1ab1904ececbaf0fdf to your computer and use it in GitHub Desktop.
// GIVEN
const http = require('some-well-known-http-request-module');
sandbox.stub(http, 'post').returns(EXPECTED_RESPONSE_BODY);
// WHEN
makeRestApiCall(EXPECTED_POST_DATA);
// THEN
expect(http.post).to.have.been
.calledWith('http://example.com/rest/api/expectedEndPoint', EXPECTED_POST_DATA);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment