44 lines
5.9 KiB
JavaScript
44 lines
5.9 KiB
JavaScript
|
/// <reference path="../ts/typings/main.d.ts" />
|
||
|
var smartci = require("../dist/index.js");
|
||
|
var should = require("should");
|
||
|
process.env.TRAVIS_JOB_NUMBER = "180.3";
|
||
|
process.env.TRAVIS_TAG = "";
|
||
|
process.env.CI = "true";
|
||
|
describe("smartci", function () {
|
||
|
describe("check", function () {
|
||
|
describe(".isCi", function () {
|
||
|
it("should state if we are in a CI environment", function () {
|
||
|
smartci.check.isCi().should.be.true();
|
||
|
process.env.CI = "false";
|
||
|
smartci.check.isCi().should.be.false();
|
||
|
});
|
||
|
});
|
||
|
describe(".isTaggedCommit", function () {
|
||
|
it("should state if we are dealing with a tagged commit", function () {
|
||
|
smartci.check.isTaggedCommit().should.be.false();
|
||
|
process.env.TRAVIS_TAG = "v0.3.1";
|
||
|
smartci.check.isTaggedCommit().should.be.true();
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
describe("get", function () {
|
||
|
describe(".jobNumberString", function () {
|
||
|
it("should get the correct job number", function () {
|
||
|
smartci.get.jobNumberString().should.equal("180.3");
|
||
|
});
|
||
|
});
|
||
|
describe(".mainJobNumber", function () {
|
||
|
it("should get the correct main job number", function () {
|
||
|
smartci.get.mainJobNumber().should.equal(180);
|
||
|
});
|
||
|
});
|
||
|
describe(".subJobNumber", function () {
|
||
|
it("should get the correct sub job number", function () {
|
||
|
smartci.get.subJobNumber().should.equal(3);
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
|
||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzFDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQzt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