smarturl/test/test.ts

26 lines
707 B
TypeScript
Raw Normal View History

2020-03-27 13:40:03 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
import * as smarturl from '../ts/index';
2021-04-12 19:18:36 +00:00
let testSmarturl: smarturl.Smarturl;
2020-03-27 13:40:03 +00:00
tap.test('first test', async () => {
2021-04-12 19:18:36 +00:00
testSmarturl = new smarturl.Smarturl();
expect(testSmarturl).to.be.instanceOf(smarturl.Smarturl);
2020-03-27 13:40:03 +00:00
});
2021-04-12 20:09:19 +00:00
tap.test('should parse an URL', async () => {
2021-05-02 16:32:24 +00:00
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'
}
});
2021-04-12 20:09:19 +00:00
console.log(parsedUrl);
2021-05-02 16:32:24 +00:00
console.log(parsedUrl.toString());
2021-04-12 20:09:19 +00:00
});
2020-03-27 13:40:03 +00:00
tap.start();