86 lines
12 KiB
JavaScript
86 lines
12 KiB
JavaScript
"use strict";
|
|
require("typings-test");
|
|
var smartstring = require("../dist/index");
|
|
var should = require("should");
|
|
describe("smartstring", function () {
|
|
describe(".Domain class", function () {
|
|
var testDomain;
|
|
var testDomain2;
|
|
it("should create a new Domain object", function () {
|
|
testDomain = new smartstring.Domain("https://level3D.level2D.level1D");
|
|
testDomain.should.be.instanceof(smartstring.Domain);
|
|
console.log(testDomain);
|
|
});
|
|
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");
|
|
});
|
|
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");
|
|
});
|
|
it("testDomain2 should be a basic domain", function () {
|
|
testDomain2 = new smartstring.Domain("bleu.de");
|
|
console.log(testDomain2);
|
|
});
|
|
});
|
|
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);
|
|
});
|
|
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");
|
|
});
|
|
});
|
|
});
|
|
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();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLElBQVksV0FBVyxXQUFNLGVBQWUsQ0FBQyxDQUFBO0FBQzdDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUUvQixRQUFRLENBQUMsYUFBYSxFQUFDO0lBQ25CLFFBQVEsQ0FBQyxlQUFlLEVBQUM7UUFDckIsSUFBSSxVQUE2QixDQUFDO1FBQ2xDLElBQUksV0FBOEIsQ0FBQztRQUNuQyxFQUFFLENBQUMsbUNBQW1DLEVBQUM7WUFDbkMsVUFBVSxHQUFHLElBQUksV0FBVyxDQUFDLE1BQU0sQ0FBQyxpQ0FBaUMsQ0FBQyxDQUFDO1lBQ3ZFLFVBQVUsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLENBQUM7WUFDcEQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxV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HNtYXJ0c3RyaW5nLkdpdFJlcG8oXCJnaXQraHR0cHM6Ly9naXRodWIuY29tL3B1c2hyb2Nrcy9zbWFydHN0cmluZy5naXRcIik7XG4gICAgICAgICAgICB0ZXN0R2l0LnNob3VsZC5iZS5pbnN0YW5jZW9mKHNtYXJ0c3RyaW5nLkdpdFJlcG8pO1xuICAgICAgICB9KVxuICAgICAgICBpdChcInNob3VsZCByZXR1cm4gYSAuaG9zdFwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0ZXN0R2l0Lmhvc3RcbiAgICAgICAgICAgICAgICAuc2hvdWxkLmVxdWFsKFwiZ2l0aHViLmNvbVwiKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGl0KFwic2hvdWxkIHJldHVybiBhIC51c2VyXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RHaXQudXNlclxuICAgICAgICAgICAgICAgIC5zaG91bGQuZXF1YWwoXCJwdXNocm9ja3NcIik7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCByZXR1cm4gYSAucmVwb1wiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0ZXN0R2l0LnJlcG9cbiAgICAgICAgICAgICAgICAuc2hvdWxkLmVxdWFsKFwic21hcnRzdHJpbmdcIik7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCByZXR1cm4gYSAuaHR0cHNVcmxcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgdGVzdEdpdC5odHRwc1VybFxuICAgICAgICAgICAgICAgIC5zaG91bGQuZXF1YWwoXCJodHRwczovL2dpdGh1Yi5jb20vcHVzaHJvY2tzL3NtYXJ0c3RyaW5nLmdpdFwiKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGl0KFwic2hvdWxkIHJldHVybiBhIC5zc2hVcmxcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgdGVzdEdpdC5zc2hVcmxcbiAgICAgICAgICAgICAgICAuc2hvdWxkLmVxd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