UNPKG

@lyra-network/nexus-deployer

Version:

Deploy artifacts with classifiers to release/snapshot maven repository.

129 lines (113 loc) 3.86 kB
"use strict"; var should = require("should"), mockrequest = require("../../tasks/lib/mockrequest"), fs = require("fs"); describe("Nexus Deployer Snapshots", function () { describe("Snapshots generated via grunt", function () { var snapshotHistory; var MD5_FILE_PATTERN = /\.md5/; var SHA1_FILE_PATTERN = /\.sha1/; beforeEach(function () { snapshotHistory = mockrequest.data("snapshots"); }); describe("After deployment", function () { it("9 artifacts are uploaded for snapshot", function () { snapshotHistory.length.should.equal(9); }); it("snapshot uploads must contain 3 extra metadata files", function () { snapshotHistory .filter(function (uploadCmd) { return MD5_FILE_PATTERN.test(uploadCmd); }) .length.should.equal(3); snapshotHistory .filter(function (uploadCmd) { return SHA1_FILE_PATTERN.test(uploadCmd); }) .length.should.equal(3); }); it("inner.xml should be generated correctly", function () { var expected = fs.readFileSync( "test/expected/snapshot/inner.xml", "utf8" ); var actual = fs.readFileSync("test/actual/snapshots/inner.xml", "utf8"); actual.should.equal(expected); }); it("outer.xml should be generated correctly", function () { var expected = fs.readFileSync( "test/expected/snapshot/outer.xml", "utf8" ); var actual = fs.readFileSync("test/actual/snapshots/outer.xml", "utf8"); actual.should.equal(expected); }); it("pom.xml should be generated correctly", function () { var expected = fs.readFileSync( "test/expected/snapshot/pom.xml", "utf8" ); var actual = fs.readFileSync("test/actual/snapshots/pom.xml", "utf8"); actual.should.equal(expected); }); }); }); describe("Snapshots generated via grunt", function () { var snapshotHistory; var MD5_FILE_PATTERN = /\.md5/; var SHA1_FILE_PATTERN = /\.sha1/; beforeEach(function () { snapshotHistory = mockrequest.data("nodeSnapshots"); }); describe("After deployment", function () { it("9 artifacts are uploaded for snapshot", function () { snapshotHistory.length.should.equal(9); }); it("snapshot uploads must contain 3 extra metadata files", function () { snapshotHistory .filter(function (uploadCmd) { return MD5_FILE_PATTERN.test(uploadCmd); }) .length.should.equal(3); snapshotHistory .filter(function (uploadCmd) { return SHA1_FILE_PATTERN.test(uploadCmd); }) .length.should.equal(3); }); it("inner.xml should be generated correctly", function () { var expected = fs.readFileSync( "test/expected/snapshot/inner.xml", "utf8" ); var actual = fs.readFileSync( "test/actual/nodeSnapshots/inner.xml", "utf8" ); actual.should.equal(expected); }); it("outer.xml should be generated correctly", function () { var expected = fs.readFileSync( "test/expected/snapshot/outer.xml", "utf8" ); var actual = fs.readFileSync( "test/actual/nodeSnapshots/outer.xml", "utf8" ); actual.should.equal(expected); }); it("pom.xml should be generated correctly", function () { var expected = fs.readFileSync( "test/expected/snapshot/pom.xml", "utf8" ); var actual = fs.readFileSync( "test/actual/nodeSnapshots/pom.xml", "utf8" ); actual.should.equal(expected); }); }); }); });