@qiniu/miku-delivery-mp-ks
Version:
Kuaishou Mini Program SDK for Miku Delivery
23 lines (22 loc) • 882 B
JavaScript
import { Polyfilled_URL } from './url';
it('should parse well', () => {
const u = new Polyfilled_URL('https://u:p@q.com:8080/foo/bar?a=1&b#123');
expect(u.href).toBe('https://u:p@q.com:8080/foo/bar?a=1&b#123');
expect(u.toString()).toBe('https://u:p@q.com:8080/foo/bar?a=1&b#123');
expect(u.protocol).toBe('https:');
expect(u.username).toBe('u');
expect(u.password).toBe('p');
expect(u.origin).toBe('https://q.com:8080');
expect(u.host).toBe('q.com:8080');
expect(u.hostname).toBe('q.com');
expect(u.port).toBe('8080');
expect(u.pathname).toBe('/foo/bar');
expect(u.search).toBe('?a=1&b');
expect(u.hash).toBe('#123');
});
it('should set well', () => {
const u = new Polyfilled_URL('https://u:p@q.com:8080/foo/bar?a=1&b#123');
u.search = '';
u.hash = '';
expect(u.href).toBe('https://u:p@q.com:8080/foo/bar');
});