smartstring/test/test.js

86 lines
12 KiB
JavaScript
Raw Permalink Normal View History

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;
var testDomain2;
2016-05-25 03:06:19 +00:00
it("should create a new Domain object", function () {
testDomain = new smartstring.Domain("https://level3D.level2D.level1D");
2016-05-25 03:06:19 +00:00
testDomain.should.be.instanceof(smartstring.Domain);
console.log(testDomain);
2016-05-25 03:06:19 +00:00
});
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);
});
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");
});
});
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
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLElBQVksV0FBVyxXQUFNLGVBQWUsQ0FBQyxDQUFBO0FBQzdDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUUvQixRQUFRLENBQUMsYUFBYSxFQUFDO0lBQ25CLFFBQVEsQ0FBQyxlQUFlLEVBQUM7UUFDckIsSUFBSSxVQUE2QixDQUFDO1FBQ2xDLElBQUksV0FBOEIsQ0FBQztRQUNuQyxFQUFFLENBQUMsbUNBQW1DLEVBQUM7WUFDbkMsVUFBVSxHQUFHLElBQUksV0FBVyxDQUFDLE1BQU0sQ0FBQyxpQ0FBaUMsQ0FBQyxDQUFDO1lBQ3ZFLFVBQVUsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLENBQUM7WUFDcEQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLENBQUMsQ0FBQztRQUM1QixDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUsQ0FBQyx5QkFBeUIsRUFBQztZQUN6QixVQUFVLENBQUMsUUFBUSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUF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