2016-05-25 03:06:19 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-test");
|
|
|
|
var smartstring = require("../dist/index");
|
2016-02-23 06:06:54 +00:00
|
|
|
var should = require("should");
|
|
|
|
describe("smartstring", function () {
|
2016-05-25 03:06:19 +00:00
|
|
|
describe(".Domain class", function () {
|
|
|
|
var testDomain;
|
|
|
|
it("should create a new Domain object", function () {
|
2016-05-25 04:54:55 +00:00
|
|
|
testDomain = new smartstring.Domain("https://level3D.level2D.level1D");
|
2016-05-25 03:06:19 +00:00
|
|
|
testDomain.should.be.instanceof(smartstring.Domain);
|
|
|
|
});
|
|
|
|
it("should have a .topLevel", function () {
|
|
|
|
testDomain.topLevel.should.equal("level1D");
|
|
|
|
});
|
|
|
|
it("should have a .level2", function () {
|
|
|
|
testDomain.level2.should.equal("level2D");
|
|
|
|
});
|
|
|
|
it("should have a .level3", function () {
|
|
|
|
testDomain.level3.should.equal("level3D");
|
|
|
|
});
|
2016-05-25 04:54:55 +00:00
|
|
|
it("should have the correct dns zone name", function () {
|
|
|
|
testDomain.zoneName.should.equal("level2D.level1D");
|
|
|
|
});
|
|
|
|
it("should have the correct protocol", function () {
|
|
|
|
testDomain.protocol.should.equal("https");
|
|
|
|
});
|
2016-05-25 03:06:19 +00:00
|
|
|
});
|
|
|
|
describe(".Git class", function () {
|
|
|
|
var testGit;
|
|
|
|
it("should create a new Git class GitRepo", function () {
|
|
|
|
testGit = new smartstring.GitRepo("git+https://github.com/pushrocks/smartstring.git");
|
|
|
|
testGit.should.be.instanceof(smartstring.GitRepo);
|
|
|
|
});
|
2016-02-23 06:06:54 +00:00
|
|
|
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");
|
|
|
|
});
|
|
|
|
});
|
2016-04-15 22:58:44 +00:00
|
|
|
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-04-15 22:58:44 +00:00
|
|
|
|
2016-05-25 04:54:55 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLElBQVksV0FBVyxXQUFNLGVBQWUsQ0FBQyxDQUFBO0FBQzdDLElBQU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