Created
February 12, 2015 21:36
-
-
Save areichman/c99fbd33a3716cbf8e2a to your computer and use it in GitHub Desktop.
Create a mock response for the request module using a Jasmine spy
This file contains hidden or 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
var request = require('request') | |
spyOn(request, 'get').andCallFake(function(params, callback) { | |
var res = { | |
statusCode: 200 | |
} | |
var body = { | |
// JSON attributes | |
} | |
callback(null, res, body) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment