40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { expect, tap } from '@pushrocks/tapbundle';
|
|
import * as smarturl from '../ts/index.js';
|
|
|
|
let testSmarturl: smarturl.Smarturl;
|
|
|
|
tap.test('first test', async () => {
|
|
testSmarturl = new smarturl.Smarturl();
|
|
expect(testSmarturl).toBeInstanceOf(smarturl.Smarturl);
|
|
});
|
|
|
|
tap.test('should parse an URL', async () => {
|
|
const testUrl = 'https://lossless.com:3000/?some=cool&more=yes';
|
|
// const urlMod = await import('url');
|
|
// const altParsed = urlMod.parse(testUrl);
|
|
// console.log(altParsed);
|
|
const parsedUrl = smarturl.Smarturl.createFromUrl(testUrl, {
|
|
searchParams: {
|
|
more: 'overwritten',
|
|
},
|
|
});
|
|
console.log(parsedUrl);
|
|
console.log(parsedUrl.toString());
|
|
});
|
|
|
|
tap.test('should parse an URL', async () => {
|
|
const testUrl = 'https://lossless.com:3000/';
|
|
// const urlMod = await import('url');
|
|
// const altParsed = urlMod.parse(testUrl);
|
|
// console.log(altParsed);
|
|
const parsedUrl = smarturl.Smarturl.createFromUrl(testUrl, {
|
|
searchParams: {
|
|
more: 'overwritten',
|
|
},
|
|
});
|
|
console.log(parsedUrl);
|
|
console.log(parsedUrl.toString());
|
|
});
|
|
|
|
tap.start();
|