Last active
August 29, 2015 14:10
-
-
Save lennym/870e1a153fd8a72acccc to your computer and use it in GitHub Desktop.
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
// example test script for module with http.get | |
// uses sinon, chai and mocha. | |
var Module = require('./my-module-that-does-http'); | |
var http = require('http'); | |
describe('Module', function () { | |
beforeEach(function () { | |
sinon.stub(http, 'get').yields(mockresponse); | |
}); | |
afterEach(function () { | |
http.get.restore(); | |
}); | |
it('does an http.get', function () { | |
Module.foo(); | |
http.get.should.have.been.called; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment