diff options
Diffstat (limited to 'test/getOptions.js')
| -rw-r--r-- | test/getOptions.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/getOptions.js b/test/getOptions.js index 8a77708..ac26caf 100644 --- a/test/getOptions.js +++ b/test/getOptions.js @@ -115,6 +115,9 @@ describe("getOptions", function(){ it ("should set service_name if it exists", function(done){ testServiceName(getOptions, done); }); + it("should set service_pull_request if it exists", function(done){ + testServicePullRequest(getOptions, done); + }); it ("should set service_name and service_job_id if it's running on travis-ci", function(done){ testTravisCi(getOptions, done); }); @@ -135,6 +138,14 @@ describe("getOptions", function(){ it ("should set service_name and service_job_id if it's running on wercker", function(done){ testWercker(getOptions, done); }); + it ("should override set options with user options", function(done){ + var userOptions = {service_name: 'OVERRIDDEN_SERVICE_NAME'}; + process.env.COVERALLS_SERVICE_NAME = "SERVICE_NAME"; + getOptions(function(err, options){ + options.service_name.should.equal("OVERRIDDEN_SERVICE_NAME"); + done(); + }, userOptions); + }); }); var testServiceJobId = function(sut, done){ @@ -246,6 +257,14 @@ var testServiceName = function(sut, done){ }); }; +var testServicePullRequest = function(sut, done){ + process.env.CI_PULL_REQUEST = "https://github.com/fake/fake/pulls/123"; + sut(function(err, options){ + options.service_pull_request.should.equal("123"); + done(); + }); +}; + var testTravisCi = function(sut, done){ process.env.TRAVIS = "TRUE"; process.env.TRAVIS_JOB_ID = "1234"; |
