2022-03-18 21:50:24 +00:00
|
|
|
import * as smartstring from '../ts/index.js';
|
2023-08-18 11:12:25 +00:00
|
|
|
import { tap, expect } from '@push.rocks/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');
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testDomain).toBeInstanceOf(smartstring.Domain);
|
2018-07-21 12:37:39 +00:00
|
|
|
console.log(testDomain);
|
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have a .topLevel', async () => {
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testDomain.topLevel).toEqual('level1D');
|
2018-07-21 12:37:39 +00:00
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have a .level2', async () => {
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testDomain.level2).toEqual('level2D');
|
2018-07-21 12:37:39 +00:00
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have a .level3', async () => {
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testDomain.level3).toEqual('level3D');
|
2018-07-21 12:37:39 +00:00
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have the correct dns zone name', async () => {
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testDomain.zoneName).toEqual('level2D.level1D');
|
2018-07-21 12:37:39 +00:00
|
|
|
});
|
2017-10-05 13:55:59 +00:00
|
|
|
tap.test('expect have the correct protocol', async () => {
|
2022-03-18 21:50:24 +00:00
|
|
|
expect(testDomain.protocol).toEqual('https');
|
2018-07-21 12:37:39 +00:00
|
|
|
});
|
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();
|