update dependencies and allow dots in git user and repo names
This commit is contained in:
87
test/test.js
87
test/test.js
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,QAAQ,EAAC;QACd,IAAI,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAClF,EAAE,CAAC,uBAAuB,EAAC;YACvB,OAAO,CAAC,IAAI;iBACP,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,uBAAuB,EAAC;YACvB,OAAO,CAAC,IAAI;iBACP,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,uBAAuB,EAAC;YACvB,OAAO,CAAC,IAAI;iBACP,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,2BAA2B,EAAC;YAC3B,OAAO,CAAC,QAAQ;iBACX,MAAM,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,yBAAyB,EAAC;YACzB,OAAO,CAAC,MAAM;iBACT,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAA;IACF,QAAQ,CAAC,SAAS,EAAC;QACf,QAAQ,CAAC,gBAAgB,EAAC;YACtB,EAAE,CAAC,4BAA4B,EAAC;gBAC5B,IAAI,cAAc,GAAG,CAAC,6BAA6B,EAAC,8BAA8B,CAAC,CAAC;gBACpF,IAAI,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;gBACjE,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;gBACtD,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAC"}
|
199
test/test.ts
199
test/test.ts
@ -1,115 +1,118 @@
|
||||
import 'typings-test'
|
||||
import * as smartstring from '../dist/index'
|
||||
import * as should from 'should'
|
||||
import { expect } from 'smartchai'
|
||||
|
||||
describe('smartstring',function(){
|
||||
describe('.Base64 class', function(){
|
||||
let testBase64: smartstring.Base64
|
||||
it('should create a valid instance of Base64', function(){
|
||||
testBase64 = new smartstring.Base64('somestring', 'string')
|
||||
should(testBase64).be.instanceOf(smartstring.Base64)
|
||||
})
|
||||
it('should read output a file as base64 and base64uri', function(){
|
||||
should(testBase64.base64String).not.equal(testBase64.base64UriString)
|
||||
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri')
|
||||
should(testBase64_2.simpleString).equal(testBase64.simpleString)
|
||||
})
|
||||
describe('smartstring', function () {
|
||||
describe('.Base64 class', function () {
|
||||
let testBase64: smartstring.Base64
|
||||
it('expect create a valid instance of Base64', function () {
|
||||
testBase64 = new smartstring.Base64('somestring', 'string')
|
||||
expect(testBase64).be.instanceOf(smartstring.Base64)
|
||||
})
|
||||
describe('.Domain class',function(){
|
||||
let testDomain:smartstring.Domain
|
||||
let testDomain2:smartstring.Domain
|
||||
it('should create a new Domain object',function(){
|
||||
testDomain = new smartstring.Domain('https://level3D.level2D.level1D')
|
||||
should(testDomain).be.instanceof(smartstring.Domain)
|
||||
console.log(testDomain)
|
||||
})
|
||||
it('should have a .topLevel',function(){
|
||||
should(testDomain.topLevel).equal('level1D')
|
||||
})
|
||||
it('should have a .level2',function(){
|
||||
should(testDomain.level2).equal('level2D')
|
||||
})
|
||||
it('should have a .level3',function(){
|
||||
should(testDomain.level3).equal('level3D')
|
||||
})
|
||||
it('should have the correct dns zone name',function(){
|
||||
should(testDomain.zoneName).equal('level2D.level1D')
|
||||
})
|
||||
it ('should have the correct protocol',function(){
|
||||
should(testDomain.protocol).equal('https')
|
||||
})
|
||||
it('testDomain2 should be a basic domain',function(){
|
||||
testDomain2 = new smartstring.Domain('bleu.de')
|
||||
console.log(testDomain2)
|
||||
})
|
||||
it('expect read output a file as base64 and base64uri', function () {
|
||||
expect(testBase64.base64String).not.equal(testBase64.base64UriString)
|
||||
let testBase64_2 = new smartstring.Base64(testBase64.base64UriString, 'base64uri')
|
||||
expect(testBase64_2.simpleString).equal(testBase64.simpleString)
|
||||
})
|
||||
describe('.Git class',function(){
|
||||
let testGit:smartstring.GitRepo
|
||||
it('should create a new Git class GitRepo',function(){
|
||||
testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git')
|
||||
should(testGit).be.instanceof(smartstring.GitRepo)
|
||||
})
|
||||
it('should return a .host',function(){
|
||||
should(testGit.host).equal('github.com')
|
||||
})
|
||||
it('should return a .user',function(){
|
||||
should(testGit.user).equal('pushrocks')
|
||||
})
|
||||
it('should return a .repo',function(){
|
||||
should(testGit.repo).equal('smartstring')
|
||||
})
|
||||
it('should return a .httpsUrl',function(){
|
||||
should(testGit.httpsUrl).equal('https://github.com/pushrocks/smartstring.git')
|
||||
})
|
||||
it('should return a .sshUrl',function(){
|
||||
should(testGit.sshUrl).equal('git@github.com:pushrocks/smartstring.git')
|
||||
})
|
||||
})
|
||||
describe('.Domain class', function () {
|
||||
let testDomain: smartstring.Domain
|
||||
let testDomain2: smartstring.Domain
|
||||
it('expect create a new Domain object', function () {
|
||||
testDomain = new smartstring.Domain('https://level3D.level2D.level1D')
|
||||
expect(testDomain).be.instanceof(smartstring.Domain)
|
||||
console.log(testDomain)
|
||||
})
|
||||
describe('.docker',function(){
|
||||
describe('.makeEnvObject',function(){
|
||||
it('should create a Env Object',function(){
|
||||
let envStringArray = ['VIRTUAL_HOST=sub.domain.tld','DEFAULT_HOST=some.domain.com']
|
||||
let envObject:any = smartstring.docker.makeEnvObject(envStringArray)
|
||||
envObject.VIRTUAL_HOST.should.equal('sub.domain.tld')
|
||||
envObject.DEFAULT_HOST.should.equal('some.domain.com')
|
||||
})
|
||||
})
|
||||
it('expect have a .topLevel', function () {
|
||||
expect(testDomain.topLevel).equal('level1D')
|
||||
})
|
||||
describe('.indent',function(){
|
||||
let testString = `
|
||||
it('expect have a .level2', function () {
|
||||
expect(testDomain.level2).equal('level2D')
|
||||
})
|
||||
it('expect have a .level3', function () {
|
||||
expect(testDomain.level3).equal('level3D')
|
||||
})
|
||||
it('expect have the correct dns zone name', function () {
|
||||
expect(testDomain.zoneName).equal('level2D.level1D')
|
||||
})
|
||||
it('expect have the correct protocol', function () {
|
||||
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: smartstring.GitRepo
|
||||
it('expect create a new Git class GitRepo', function () {
|
||||
testGit = new smartstring.GitRepo('git+https://github.com/pushrocks/smartstring.git')
|
||||
expect(testGit).be.instanceof(smartstring.GitRepo)
|
||||
})
|
||||
it('expect return a .host', function () {
|
||||
expect(testGit.host).equal('github.com')
|
||||
})
|
||||
it('expect return a .user', function () {
|
||||
expect(testGit.user).equal('pushrocks')
|
||||
})
|
||||
it('expect return a .repo', function () {
|
||||
expect(testGit.repo).equal('smartstring')
|
||||
})
|
||||
it('expect return a .httpsUrl', function () {
|
||||
expect(testGit.httpsUrl).equal('https://github.com/pushrocks/smartstring.git')
|
||||
})
|
||||
it('expect return a .sshUrl', function () {
|
||||
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: any = smartstring.docker.makeEnvObject(envStringArray)
|
||||
expect(envObject.VIRTUAL_HOST).to.equal('sub.domain.tld')
|
||||
expect(envObject.DEFAULT_HOST).to.equal('some.domain.com')
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('.indent', function () {
|
||||
let testString = `
|
||||
base
|
||||
should be indented
|
||||
expect be indented
|
||||
some more
|
||||
|
||||
base
|
||||
indented
|
||||
`
|
||||
describe('.normalize()',function(){
|
||||
it('should normalize a string',function(){
|
||||
testString = smartstring.indent.normalize(testString)
|
||||
console.log(testString)
|
||||
let zoneNameArg = 'test1'
|
||||
let destinationIpArg = '111'
|
||||
})
|
||||
})
|
||||
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('should indent',function(){
|
||||
testString = smartstring.indent.indentWithPrefix(testString,'>> ')
|
||||
console.log(testString)
|
||||
})
|
||||
})
|
||||
describe('.indentWithPrefix', function () {
|
||||
it('expect indent', function () {
|
||||
testString = smartstring.indent.indentWithPrefix(testString, '>> ')
|
||||
console.log(testString)
|
||||
})
|
||||
})
|
||||
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()
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('.typescript', function () {
|
||||
describe('.referenceRegex', function () {
|
||||
it('expect match reference paths', function () {
|
||||
expect(
|
||||
smartstring.typescript.regexReferencePath.test('/// <reference path=\"\" />')
|
||||
).to.be.true
|
||||
expect(
|
||||
smartstring.typescript.regexReferencePath.test("/// <reference path='' />")
|
||||
).to.be.true
|
||||
expect(
|
||||
smartstring.typescript.regexReferencePath.test('/// <referencepath=\"\" />')
|
||||
).to.be.false
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user