2018-07-21 12:37:39 +00:00
|
|
|
import * as smartstring from '../ts/index';
|
|
|
|
import { tap, expect } from '@pushrocks/tapbundle';
|
2017-10-05 13:55:59 +00:00
|
|
|
|
|
|
|
// Domain
|
2018-07-21 12:37:39 +00:00
|
|
|
let testDomain: smartstring.Domain;
|
|
|
|
let testDomain2: smartstring.Domain;
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect create a new Domain object', async () => {
|
2018-07-21 12:37:39 +00:00
|
|
|
testDomain = new smartstring.Domain('https://level3D.level2D.level1D');
|
|
|
|
expect(testDomain).be.instanceof(smartstring.Domain);
|
|
|
|
console.log(testDomain);
|
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have a .topLevel', async () => {
|
2018-07-21 12:37:39 +00:00
|
|
|
expect(testDomain.topLevel).equal('level1D');
|
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have a .level2', async () => {
|
2018-07-21 12:37:39 +00:00
|
|
|
expect(testDomain.level2).equal('level2D');
|
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have a .level3', async () => {
|
2018-07-21 12:37:39 +00:00
|
|
|
expect(testDomain.level3).equal('level3D');
|
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have the correct dns zone name', async () => {
|
2018-07-21 12:37:39 +00:00
|
|
|
expect(testDomain.zoneName).equal('level2D.level1D');
|
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have the correct protocol', async () => {
|
2018-07-21 12:37:39 +00:00
|
|
|
expect(testDomain.protocol).equal('https');
|
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('testDomain2 expect be a basic domain', async () => {
|
2021-01-22 18:27:50 +00:00
|
|
|
testDomain2 = new smartstring.Domain('testing.bleu.de');
|
2018-07-21 12:37:39 +00:00
|
|
|
console.log(testDomain2);
|
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
|
2021-01-22 14:46:02 +00:00
|
|
|
tap.test('should parse complex domains', async () => {
|
|
|
|
testDomain2 = new smartstring.Domain('https://sub1.sub2.lossless.com/some/path:5431');
|
|
|
|
console.log(testDomain2);
|
|
|
|
});
|
|
|
|
|
2018-07-21 12:37:39 +00:00
|
|
|
tap.start();
|