update smartci to have simpler exported logic
This commit is contained in:
1
test/test.d.ts
vendored
Normal file
1
test/test.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
import "typings-test";
|
33
test/test.js
33
test/test.js
@ -1,42 +1,25 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
"use strict";
|
||||
require("typings-test");
|
||||
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();
|
||||
smartci.isCi().should.be.true();
|
||||
process.env.CI = "false";
|
||||
smartci.check.isCi().should.be.false();
|
||||
smartci.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);
|
||||
smartci.isTaggedCommit().should.be.false();
|
||||
process.env.CI_BUILD_TAG = "3.1.2";
|
||||
smartci.isTaggedCommit().should.be.true();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=test.js.map
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJz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ZLEdBQUcsT0FBTyxDQUFDO2dCQUNuQyxPQUFPLENBQUMsY0FBYyxFQUFFLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUM5QyxDQUFDLENBQUMsQ0FBQTtRQUNOLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyJ9
|
31
test/test.ts
31
test/test.ts
@ -1,44 +1,25 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
import "typings-test";
|
||||
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();
|
||||
smartci.isCi().should.be.true();
|
||||
process.env.CI = "false";
|
||||
smartci.check.isCi().should.be.false();
|
||||
smartci.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();
|
||||
smartci.isTaggedCommit().should.be.false();
|
||||
process.env.CI_BUILD_TAG = "3.1.2";
|
||||
smartci.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);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user