diff options
| author | Nick Merwin <[email protected]> | 2016-09-15 10:11:26 -0700 |
|---|---|---|
| committer | Nick Merwin <[email protected]> | 2016-09-15 10:11:26 -0700 |
| commit | e8122cebf6eda6bd4e196f032e89b55797f1db4b (patch) | |
| tree | f5e3ad51bc266e9a3be7d97774193b921026aaf6 /test | |
| parent | 993332233a2f02695a769e2c17c0d593a96b14c9 (diff) | |
| parent | b92746cd71fd1b0e7cb65dbca7f64270db62eed6 (diff) | |
| download | node-coveralls-e8122cebf6eda6bd4e196f032e89b55797f1db4b.tar.xz node-coveralls-e8122cebf6eda6bd4e196f032e89b55797f1db4b.zip | |
Merge branch 'master' into pr/127
Diffstat (limited to 'test')
| -rw-r--r-- | test/fetchGitData.js | 8 | ||||
| -rw-r--r-- | test/getOptions.js | 34 |
2 files changed, 34 insertions, 8 deletions
diff --git a/test/fetchGitData.js b/test/fetchGitData.js index cd0a679..012e129 100644 --- a/test/fetchGitData.js +++ b/test/fetchGitData.js @@ -98,14 +98,14 @@ describe("fetchGitData", function(){ "covert": "to a string" } }, function(err, str){ - str.branch.should.be.a("string"); + str.branch.should.be.String(); fetchGitData({ "head": { "id": "COMMIT_HASH" }, "branch": ["convert", "to", "a", "string"] }, function(err, str){ - str.branch.should.be.a("string"); + str.branch.should.be.String(); done(); }); }); @@ -168,11 +168,11 @@ describe("fetchGitData", function(){ process.env.COVERALLS_GIT_BRANCH = "master"; getOptions(function(err, options){ options = options.git; - options.head.should.be.a("object"); + options.head.should.be.Object(); options.head.author_name.should.not.equal("Unknown Author"); options.head.committer_name.should.not.equal("Unknown Committer"); options.head.message.should.not.equal("Unknown Commit Message"); - options.branch.should.be.a("string"); + options.branch.should.be.String(); options.should.have.property("remotes"); options.remotes.should.be.instanceof(Array); options.remotes.length.should.be.above(0); diff --git a/test/getOptions.js b/test/getOptions.js index 3394a85..bd38b7c 100644 --- a/test/getOptions.js +++ b/test/getOptions.js @@ -144,6 +144,9 @@ describe("getOptions", function(){ it ("should set service_name and service_job_id if it's running on Gitlab", function(done){ testGitlab(getOptions, done); }); + it ("should set service_name and service_job_id if it's running via Surf", function(done){ + testSurf(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"; @@ -203,7 +206,7 @@ var testGitBranchDetection = function(sut, done){ if (localGit.branch) options.git.branch.should.equal(localGit.branch); else - options.git.should.not.have.property('branch'); + options.git.should.not.have.key('branch'); localGit.wrapUp(); done(); }); @@ -338,6 +341,9 @@ var testCodeship = function(sut, done) { process.env.CI_BUILD_NUMBER = '1234'; process.env.CI_COMMIT_ID = "e3e3e3e3e3e3e3e3e"; process.env.CI_BRANCH = "master"; + process.env.CI_COMMITTER_NAME = "John Doe"; + process.env.CI_COMMITTER_EMAIL = "[email protected]"; + process.env.CI_COMMIT_MESSAGE = "adadadadadadadadadad"; sut(function(err, options){ options.service_name.should.equal("codeship"); options.service_job_id.should.equal("1234"); @@ -345,9 +351,9 @@ var testCodeship = function(sut, done) { { id: 'e3e3e3e3e3e3e3e3e', author_name: 'Unknown Author', author_email: '', - committer_name: 'Unknown Committer', - committer_email: '', - message: 'Unknown Commit Message' }, + committer_name: 'John Doe', + committer_email: '[email protected]', + message: 'adadadadadadadadadad' }, branch: 'master', remotes: [] }); done(); @@ -418,6 +424,26 @@ var testGitlab = function(sut, done) { }); }; +var testSurf = function(sut, done) { + process.env.CI_NAME = 'surf'; + process.env.SURF_SHA1 = "e3e3e3e3e3e3e3e3e"; + process.env.SURF_REF = "feature"; + sut(function(err, options){ + options.service_name.should.equal("surf"); + options.git.should.eql({ head: + { id: 'e3e3e3e3e3e3e3e3e', + author_name: 'Unknown Author', + author_email: '', + committer_name: 'Unknown Committer', + committer_email: '', + message: 'Unknown Commit Message' }, + branch: 'feature', + remotes: [] }); + done(); + }); +}; + + function ensureLocalGitContext(options) { var path = require('path'); var fs = require('fs'); |
