projectinfo/test/test.js

41 lines
5.1 KiB
JavaScript
Raw Normal View History

2016-02-20 04:05:07 +00:00
/// <reference path="../ts/typings/main.d.ts" />
var projectinfo = require("../dist/index.js");
var should = require("should");
var path = require("path");
var testBasePath = path.resolve(__dirname);
describe("projectinfo", function () {
describe(".npm() return", function () {
2016-02-23 08:36:40 +00:00
var myNpm = projectinfo.npm(testBasePath, { gitAccessToken: "sometoken" });
2016-02-20 04:05:07 +00:00
it("should have .packageJson", function () {
myNpm.packageJson
.should.have.property("version", "1.0.0");
myNpm.packageJson
.should.have.property("name", "testpackage");
});
it("should have .version", function () {
myNpm
2016-02-21 16:17:31 +00:00
.should.have.property("version", "1.0.0");
2016-02-20 04:05:07 +00:00
});
it("should have .name", function () {
myNpm
.should.have.property("name", "testpackage");
});
2016-02-21 16:17:31 +00:00
it("should have .license", function () {
myNpm
.should.have.property("license", "MIT");
});
2016-02-23 07:48:41 +00:00
it("should have .git", function () {
myNpm.git.httpsUrl
2016-02-23 08:36:40 +00:00
.should.equal("https://sometoken@github.com/someuser/somerepo.git");
2016-02-23 07:48:41 +00:00
});
2016-02-20 04:05:07 +00:00
});
2016-02-20 05:06:43 +00:00
describe(".getName()", function () {
it("should return a name", function () {
projectinfo.getName(testBasePath)
.should.equal("testpackage");
});
});
2016-02-20 04:05:07 +00:00
});
2016-02-23 08:36:40 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzlDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUMvQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDM0IsSUFBSSxZQUFZLEdBQUcsSUFBS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AgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwidmVyc2lvblwiLFwiMS4wLjBcIik7XG4gICAgICAgICAgICBteU5wbS5wYWNrYWdlSnNvblxuICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGl0KFwic2hvdWxkIGhhdmUgLnZlcnNpb25cIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgbXlOcG1cbiAgICAgICAgICAgICAgICAuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJ2ZXJzaW9uXCIsXCIxLjAuMFwiKVxuICAgICAgICB9KTtcblxuICAgICAgICBpdChcInNob3VsZCBoYXZlIC5uYW1lXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIG15TnBtXG4gICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGl0KFwic2hvdWxkIGhhdmUgLmxpY2Vuc2VcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgbXlOcG1cbiAgICAgICAgICAgICAgICAuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJsaWNlbnNlXCIsXCJNSVRcIik7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCBoYXZlIC5naXRcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgbXlOcG0uZ2l0Lmh0dHBzVXJsXG4gICAgICAgICAgICAgICAgLnNob3VsZC5lcXVhbChcImh0dHBzOi8vc29tZXRva2VuQGdpdGh1Yi5jb20vc29tZXVzZXIvc29tZXJlcG8uZ2l0XCIpO1xuICAgICAgICB9KTtcblxuICAgIH0pO1xuXG4gICAgZGVzY3JpYmUoXCIuZ2V0TmFtZSgpXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgaXQoXCJzaG91bGQgcmV0dXJuIGEgbmFtZVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBwcm9qZWN0aW5mby5nZXROYW1lKHRlc3RCYXNlUGF0aClcbiAgICAgICAgICAgICAgICAuc2hvdWxkLmVxdWFsKFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuICAgIH0pXG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=