smartstring/test/test.js

53 lines
7.4 KiB
JavaScript
Raw Normal View History

2016-02-23 06:06:54 +00:00
/// <reference path="../ts/typings/main.d.ts" />
var smartstring = require("../dist/index.js");
var should = require("should");
describe("smartstring", function () {
describe(".git()", function () {
var testGit = smartstring.git("git+https://github.com/pushrocks/smartstring.git");
it("should return a .host", function () {
testGit.host
.should.equal("github.com");
});
it("should return a .user", function () {
testGit.user
.should.equal("pushrocks");
});
it("should return a .repo", function () {
testGit.repo
.should.equal("smartstring");
});
it("should return a .httpsUrl", function () {
testGit.httpsUrl
.should.equal("https://github.com/pushrocks/smartstring.git");
});
it("should return a .sshUrl", function () {
testGit.sshUrl
.should.equal("git@github.com:pushrocks/smartstring.git");
});
});
describe(".docker", function () {
describe(".makeEnvObject", function () {
it("should create a Env Object", function () {
var envStringArray = ["VIRTUAL_HOST=sub.domain.tld", "DEFAULT_HOST=some.domain.com"];
var envObject = smartstring.docker.makeEnvObject(envStringArray);
envObject.VIRTUAL_HOST.should.equal("sub.domain.tld");
envObject.DEFAULT_HOST.should.equal("some.domain.com");
});
});
});
2016-05-01 11:32:04 +00:00
describe(".typescript", function () {
describe(".referenceRegex", function () {
it("should match reference paths", function () {
smartstring.typescript.regexReferencePath.test("/// <reference path=\"\" />")
.should.be.true();
smartstring.typescript.regexReferencePath.test("/// <reference path='' />")
.should.be.true();
smartstring.typescript.regexReferencePath.test("/// <referencepath=\"\" />")
.should.be.false();
});
});
});
2016-02-23 06:06:54 +00:00
});
2016-05-16 22:02:29 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzlDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQ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