projectinfo/test/test.js

42 lines
5.1 KiB
JavaScript
Raw Normal View History

2016-06-09 01:13:40 +00:00
"use strict";
require("typings-test");
2016-02-20 04:05:07 +00:00
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-06-09 01:13:40 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsSUFBSSxXQUFXLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBQUM7QUFDOUMsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQy9CLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0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xuICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwidmVyc2lvblwiLFwiMS4wLjBcIik7XG4gICAgICAgICAgICBteU5wbS5wYWNrYWdlSnNvblxuICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGl0KFwic2hvdWxkIGhhdmUgLnZlcnNpb25cIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgbXlOcG1cbiAgICAgICAgICAgICAgICAuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJ2ZXJzaW9uXCIsXCIxLjAuMFwiKVxuICAgICAgICB9KTtcblxuICAgICAgICBpdChcInNob3VsZCBoYXZlIC5uYW1lXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIG15TnBtXG4gICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGl0KFwic2hvdWxkIGhhdmUgLmxpY2Vuc2VcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgbXlOcG1cbiAgICAgICAgICAgICAgICAuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJsaWNlbnNlXCIsXCJNSVRcIik7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCBoYXZlIC5naXRcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgbXlOcG0uZ2l0Lmh0dHBzVXJsXG4gICAgICAgICAgICAgICAgLnNob3VsZC5lcXVhbChcImh0dHBzOi8vc29tZXRva2VuQGdpdGh1Yi5jb20vc29tZXVzZXIvc29tZXJlcG8uZ2l0XCIpO1xuICAgICAgICB9KTtcblxuICAgIH0pO1xuXG4gICAgZGVzY3JpYmUoXCIuZ2V0TmFtZSgpXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgaXQoXCJzaG91bGQgcmV0dXJuIGEgbmFtZVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBwcm9qZWN0aW5mby5nZXROYW1lKHRlc3RCYXNlUGF0aClcbiAgICAgICAgICAgICAgICAuc2hvdWxkLmVxdWFsKFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuICAgIH0pXG59KTsiXX0=