2016-06-05 11:01:45 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-test");
|
|
|
|
require("should");
|
|
|
|
var path = require("path");
|
2016-06-05 11:50:45 +00:00
|
|
|
var beautylog = require("beautylog");
|
2016-06-05 11:01:45 +00:00
|
|
|
//set up environment
|
|
|
|
process.env.CI_BUILD_REPO = "https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git";
|
|
|
|
process.cwd = function () {
|
|
|
|
return path.join(__dirname, "assets/");
|
|
|
|
};
|
|
|
|
//require NPMCI files
|
|
|
|
var NpmciBuildDocker = require("../dist/npmci.build.docker");
|
|
|
|
var dockerfile1;
|
|
|
|
var dockerfile2;
|
|
|
|
var sortableArray;
|
|
|
|
describe("NPMCI", function () {
|
|
|
|
describe("build.docker", function () {
|
|
|
|
it("should return valid Dockerfiles", function () {
|
|
|
|
dockerfile1 = new NpmciBuildDocker.Dockerfile({ filePath: "./Dockerfile", read: true });
|
|
|
|
dockerfile2 = new NpmciBuildDocker.Dockerfile({ filePath: "./Dockerfile_sometag1", read: true });
|
|
|
|
dockerfile1.version.should.equal("latest");
|
|
|
|
dockerfile2.version.should.equal("sometag1");
|
|
|
|
});
|
|
|
|
it("should read a directory of Dockerfiles", function (done) {
|
|
|
|
NpmciBuildDocker.readDockerfiles()
|
|
|
|
.then(function (readDockerfilesArrayArg) {
|
|
|
|
readDockerfilesArrayArg[1].version.should.equal("sometag1");
|
|
|
|
sortableArray = readDockerfilesArrayArg;
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
it("should sort an array of Dockerfiles", function (done) {
|
|
|
|
NpmciBuildDocker.sortDockerfiles(sortableArray)
|
|
|
|
.then(function (sortedArrayArg) {
|
2016-06-05 11:50:45 +00:00
|
|
|
beautylog.success("final result");
|
2016-06-05 11:01:45 +00:00
|
|
|
console.log(sortedArrayArg);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-06-05 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