112 lines
10 KiB
JavaScript
112 lines
10 KiB
JavaScript
"use strict";
|
|
require("typings-test");
|
|
const smartstring = require("../dist/index");
|
|
const smartchai_1 = require("smartchai");
|
|
describe('smartstring', function () {
|
|
describe('.Base64 class', function () {
|
|
let testBase64;
|
|
it('expect create a valid instance of Base64', function () {
|
|
testBase64 = new smartstring.Base64('somestring', 'string');
|
|
smartchai_1.expect(testBase64).be.instanceOf(smartstring.Base64);
|
|
});
|
|
it('expect read output a file as base64 and base64uri', function () {
|
|
smartchai_1.expect(testBase64.base64String).not.equal(testBase64.base64UriString);
|
|
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri');
|
|
smartchai_1.expect(testBase64_2.simpleString).equal(testBase64.simpleString);
|
|
});
|
|
});
|
|
describe('.Domain class', function () {
|
|
let testDomain;
|
|
let testDomain2;
|
|
it('expect create a new Domain object', function () {
|
|
testDomain = new smartstring.Domain('https://level3D.level2D.level1D');
|
|
smartchai_1.expect(testDomain).be.instanceof(smartstring.Domain);
|
|
console.log(testDomain);
|
|
});
|
|
it('expect have a .topLevel', function () {
|
|
smartchai_1.expect(testDomain.topLevel).equal('level1D');
|
|
});
|
|
it('expect have a .level2', function () {
|
|
smartchai_1.expect(testDomain.level2).equal('level2D');
|
|
});
|
|
it('expect have a .level3', function () {
|
|
smartchai_1.expect(testDomain.level3).equal('level3D');
|
|
});
|
|
it('expect have the correct dns zone name', function () {
|
|
smartchai_1.expect(testDomain.zoneName).equal('level2D.level1D');
|
|
});
|
|
it('expect have the correct protocol', function () {
|
|
smartchai_1.expect(testDomain.protocol).equal('https');
|
|
});
|
|
it('testDomain2 expect be a basic domain', function () {
|
|
testDomain2 = new smartstring.Domain('bleu.de');
|
|
console.log(testDomain2);
|
|
});
|
|
});
|
|
describe('.Git class', function () {
|
|
let testGit;
|
|
it('expect create a new Git class GitRepo', function () {
|
|
testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git');
|
|
smartchai_1.expect(testGit).be.instanceof(smartstring.GitRepo);
|
|
});
|
|
it('expect return a .host', function () {
|
|
smartchai_1.expect(testGit.host).equal('github.com');
|
|
});
|
|
it('expect return a .user', function () {
|
|
smartchai_1.expect(testGit.user).equal('pushrocks');
|
|
});
|
|
it('expect return a .repo', function () {
|
|
smartchai_1.expect(testGit.repo).equal('smartstring');
|
|
});
|
|
it('expect return a .httpsUrl', function () {
|
|
smartchai_1.expect(testGit.httpsUrl).equal('https://github.com/pushrocks/smartstring.git');
|
|
});
|
|
it('expect return a .sshUrl', function () {
|
|
smartchai_1.expect(testGit.sshUrl).equal('git@github.com:pushrocks/smartstring.git');
|
|
});
|
|
});
|
|
describe('.docker', function () {
|
|
describe('.makeEnvObject', function () {
|
|
it('expect create a Env Object', function () {
|
|
let envStringArray = ['VIRTUAL_HOST=sub.domain.tld', 'DEFAULT_HOST=some.domain.com'];
|
|
let envObject = smartstring.docker.makeEnvObject(envStringArray);
|
|
smartchai_1.expect(envObject.VIRTUAL_HOST).to.equal('sub.domain.tld');
|
|
smartchai_1.expect(envObject.DEFAULT_HOST).to.equal('some.domain.com');
|
|
});
|
|
});
|
|
});
|
|
describe('.indent', function () {
|
|
let testString = `
|
|
base
|
|
expect be indented
|
|
some more
|
|
|
|
base
|
|
indented
|
|
`;
|
|
describe('.normalize()', function () {
|
|
it('expect normalize a string', function () {
|
|
testString = smartstring.indent.normalize(testString);
|
|
console.log(testString);
|
|
let zoneNameArg = 'test1';
|
|
let destinationIpArg = '111';
|
|
});
|
|
});
|
|
describe('.indentWithPrefix', function () {
|
|
it('expect indent', function () {
|
|
testString = smartstring.indent.indentWithPrefix(testString, '>> ');
|
|
console.log(testString);
|
|
});
|
|
});
|
|
});
|
|
describe('.typescript', function () {
|
|
describe('.referenceRegex', function () {
|
|
it('expect match reference paths', function () {
|
|
smartchai_1.expect(smartstring.typescript.regexReferencePath.test('/// <reference path=\"\" />')).to.be.true;
|
|
smartchai_1.expect(smartstring.typescript.regexReferencePath.test("/// <reference path='' />")).to.be.true;
|
|
smartchai_1.expect(smartstring.typescript.regexReferencePath.test('/// <referencepath=\"\" />')).to.be.false;
|
|
});
|
|
});
|
|
});
|
|
});
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQiw2Q0FBNEM7QUFDNUMseUNBQWtDO0FBRWxDLFFBQVEsQ0FBQyxhQUFhLEVBQUU7SUFDdEIsUUFBUSxDQUFDLGVBQWUsRUFBRTtRQUN4QixJQUFJLFVBQThCLENBQUE7UUFDbEMsRUFBRSxDQUFDLDBDQUEwQyxFQUFFO1lBQzdDLFVBQVUsR0FBRyxJQUFJLFdBQVcsQ0FBQyxNQUFNLENBQUMsWUFBWSxFQUFFLFFBQVEsQ0FBQyxDQUFBO1lBQzNELGtCQUFNLENBQUMsVUFBVSxDQUFDLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLENBQUE7UUFDdEQsQ0FBQyxDQUFDLENBQUE7UUFDRixFQUFFLENBQUMsbURBQW1ELEVBQUU7WUFDdEQsa0JBQU0sQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxVQUFVLENBQUMsZUFBZSxDQUFDLENBQUE7WUFDckUsSUFBSSxZQUFZLEdBQUcsSUFBSSxXQUFXLENBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxlQUFlLEVBQUUsV0FBVyxDQUFDLENBQUE7WUFDbEYsa0JBQU0sQ0FBQyxZQUFZLENBQUMsWUFBWSxDQUFDLENBQUMsS0FBSyxDQUFDLFVBQVUsQ0FBQyxZQUFZLENBQUMsQ0FBQTtRQUNsRSxDQUFDLENBQUMsQ0FBQTtJQUNKLENBQUMsQ0FBQ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