diff --git a/test/services/circle.js b/test/services/circle.js index 569f1b8d..cf443598 100644 --- a/test/services/circle.js +++ b/test/services/circle.js @@ -7,7 +7,7 @@ describe("Circle CI Provider", function(){ expect(circle.detect()).to.be(true); }); - it ("can get circle env info get_commit_status", function(){ + it ("can get circle env info (CircleCI 1.0)", function(){ process.env.CIRCLECI = 'true'; process.env.CIRCLE_BUILD_NUM = '1234'; process.env.CIRCLE_SHA1 = '5678'; @@ -27,4 +27,28 @@ describe("Circle CI Provider", function(){ }); }); + it ("can get circle env info (CircleCI 2.0)", function(){ + process.env.CIRCLECI = 'true'; + process.env.CIRCLE_BRANCH = 'master'; + process.env.CIRCLE_BUILD_NUM = '1234'; + process.env.CIRCLE_SHA1 = 'abcd'; + process.env.CIRCLE_NODE_INDEX = '1'; + process.env.CIRCLE_BUILD_URL = 'https://circleci.com/gh/owner/repo/1234'; + process.env.CIRCLE_COMPARE_URL = 'https://github.com/owner/repo/2408ca9...3c36cfa'; + process.env.CIRCLE_NODE_INDEX = '1'; + process.env.CIRCLE_REPOSITORY_URL = 'git@github.com:owner/repo.git'; + delete process.env.CIRCLE_PR_NUMBER; + delete process.env.CIRCLE_PROJECT_USERNAME; + delete process.env.CIRCLE_PROJECT_REPONAME; + expect(circle.configuration()).to.eql({ + service : 'circleci', + commit : 'abcd', + build : '1234.1', + job : '1234.1', + branch : 'master', + pr : undefined, + slug : 'owner/repo' + }); + }); + });