diff options
| author | Nick Merwin <[email protected]> | 2015-12-10 12:52:55 -0800 |
|---|---|---|
| committer | Nick Merwin <[email protected]> | 2015-12-10 12:52:55 -0800 |
| commit | d084add18e87fd1a292315de7c9eb171e8fd4b93 (patch) | |
| tree | c90578e6a9540b8af75a930dc25d3c07be4efee6 /test/sendToCoveralls.js | |
| parent | 712e6e4bb4d8e1a60f646d954743a6808aa7f13e (diff) | |
| parent | d60635885d243abef2cbc5b2a0da7a27d752a14b (diff) | |
| download | node-coveralls-pr/96.tar.xz node-coveralls-pr/96.zip | |
merge conflictspr/96
Diffstat (limited to 'test/sendToCoveralls.js')
| -rw-r--r-- | test/sendToCoveralls.js | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/test/sendToCoveralls.js b/test/sendToCoveralls.js index 937df95..f809319 100644 --- a/test/sendToCoveralls.js +++ b/test/sendToCoveralls.js @@ -5,9 +5,20 @@ var index = require('../index'); logger = require('log-driver')({level : false}); describe("sendToCoveralls", function(){ + var realCoverallsHost; + beforeEach(function() { + realCoverallsHost = process.env.COVERALLS_ENDPOINT; + }); + afterEach(function() { sinon.restoreAll(); + if (realCoverallsHost !== undefined) { + process.env.COVERALLS_ENDPOINT = realCoverallsHost; + } else { + delete process.env.COVERALLS_ENDPOINT; + } }); + it ("passes on the correct params to request.post", function(done){ sinon.stub(request, 'post', function(obj, cb){ obj.url.should.equal('https://coveralls.io/api/v1/jobs'); @@ -16,12 +27,28 @@ describe("sendToCoveralls", function(){ }); var obj = {"some":"obj"}; - index.sendToCoveralls(obj, function(err, response, body){ + index.sendToCoveralls(obj, function(err, response, body){ + err.should.equal('err'); + response.should.equal('response'); + body.should.equal('body'); + done(); + }); + }); + + it ("allows sending to enterprise url", function(done){ + process.env.COVERALLS_ENDPOINT = 'https://coveralls-ubuntu.domain.com'; + sinon.stub(request, 'post', function(obj, cb){ + obj.url.should.equal('https://coveralls-ubuntu.domain.com/api/v1/jobs'); + obj.form.should.eql({json : '{"some":"obj"}'}); + cb('err', 'response', 'body'); + }); + + var obj = {"some":"obj"}; + index.sendToCoveralls(obj, function(err, response, body){ err.should.equal('err'); response.should.equal('response'); body.should.equal('body'); done(); - }); }); }); |
