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 () {
|
|
|
|
var myNpm = projectinfo.npm(testBasePath);
|
|
|
|
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
|
|
|
|
.should.equal("https://github.com/someuser/somerepo.git");
|
|
|
|
});
|
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 07:48:41 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksV0FBVyxHQUFHLE9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