projectinfo/test/test.js
2016-02-20 06:06:43 +01:00

33 lines
4.0 KiB
JavaScript

/// <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
.should.have.property("name", "testpackage");
});
it("should have .name", function () {
myNpm
.should.have.property("name", "testpackage");
});
});
describe(".getName()", function () {
it("should return a name", function () {
projectinfo.getName(testBasePath)
.should.equal("testpackage");
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzlDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUMvQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDM0IsSUFBSSxZQUFZLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztBQUUzQyxRQUFRLENBQUMsYUFBYSxFQUFDO0lBQ25CLFFBQVEsQ0FBQyxlQUFlLEVBQUM7UUFDckIsSUFBSSxLQUFLLEdBQUcsV0FBVyxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUMsQ0FBQztRQUMxQyxFQUFFLENBQUMsMEJBQTBCLEVBQUM7WUFDMUIsS0FBSyxDQUFDLFdBQVc7aUJBQ2IsTUFBTSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsU0FBUyxFQUFDLE9BQU8sQ0FBQyxDQUFDO1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tZSk7XG5cbmRlc2NyaWJlKFwicHJvamVjdGluZm9cIixmdW5jdGlvbigpe1xuICAgIGRlc2NyaWJlKFwiLm5wbSgpIHJldHVyblwiLGZ1bmN0aW9uKCl7XG4gICAgICAgIHZhciBteU5wbSA9IHByb2plY3RpbmZvLm5wbSh0ZXN0QmFzZVBhdGgpO1xuICAgICAgICBpdChcInNob3VsZCBoYXZlIC5wYWNrYWdlSnNvblwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICBteU5wbS5wYWNrYWdlSnNvblxuICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwidmVyc2lvblwiLFwiMS4wLjBcIik7XG4gICAgICAgICAgICBteU5wbS5wYWNrYWdlSnNvblxuICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGl0KFwic2hvdWxkIGhhdmUgLnZlcnNpb25cIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgbXlOcG1cbiAgICAgICAgICAgICAgICAuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJuYW1lXCIsXCJ0ZXN0cGFja2FnZVwiKVxuICAgICAgICB9KTtcblxuICAgICAgICBpdChcInNob3VsZCBoYXZlIC5uYW1lXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIG15TnBtXG4gICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgfSk7XG5cbiAgICBkZXNjcmliZShcIi5nZXROYW1lKClcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCByZXR1cm4gYSBuYW1lXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHByb2plY3RpbmZvLmdldE5hbWUodGVzdEJhc2VQYXRoKVxuICAgICAgICAgICAgICAgIC5zaG91bGQuZXF1YWwoXCJ0ZXN0cGFja2FnZVwiKTtcbiAgICAgICAgfSk7XG4gICAgfSlcbn0pOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==