Buckets:
| import { parseDestination } from './prepare-destination' | |
| describe('parseDestination', () => { | |
| it('should parse the destination', () => { | |
| const destination = '/hello/:name' | |
| const params = { name: 'world' } | |
| const query = { foo: 'bar' } | |
| const result = parseDestination({ | |
| destination, | |
| params, | |
| query, | |
| }) | |
| expect(result).toMatchInlineSnapshot(` | |
| { | |
| "auth": null, | |
| "hash": "", | |
| "host": null, | |
| "hostname": null, | |
| "href": "/hello/:name", | |
| "origin": undefined, | |
| "pathname": "/hello/:name", | |
| "port": null, | |
| "protocol": null, | |
| "query": {}, | |
| "search": "", | |
| "slashes": null, | |
| } | |
| `) | |
| }) | |
| it('should parse the destination with a hash', () => { | |
| const destination = 'https://o:foo.com/hello/:name#bar' | |
| const params = { name: 'world' } | |
| const query = { foo: 'bar' } | |
| const result = parseDestination({ | |
| destination, | |
| params, | |
| query, | |
| }) | |
| expect(result).toMatchInlineSnapshot(` | |
| { | |
| "auth": null, | |
| "hash": "#bar", | |
| "hostname": "o:foo.com", | |
| "href": "https://o:foo.com/hello/:name#bar", | |
| "origin": "https://o:foo.com", | |
| "pathname": "/hello/:name", | |
| "port": "", | |
| "protocol": "https:", | |
| "query": {}, | |
| "search": "", | |
| "slashes": true, | |
| } | |
| `) | |
| }) | |
| it('should parse the destination with a host', () => { | |
| const destination = 'https://o:foo.com/hello/:name?foo=:bar' | |
| const params = { name: 'world' } | |
| const query = { foo: 'bar' } | |
| const result = parseDestination({ | |
| destination, | |
| params, | |
| query, | |
| }) | |
| expect(result).toMatchInlineSnapshot(` | |
| { | |
| "auth": null, | |
| "hash": "", | |
| "hostname": "o:foo.com", | |
| "href": "https://o:foo.com/hello/:name?foo=:bar", | |
| "origin": "https://o:foo.com", | |
| "pathname": "/hello/:name", | |
| "port": "", | |
| "protocol": "https:", | |
| "query": { | |
| "foo": ":bar", | |
| }, | |
| "search": "?foo=:bar", | |
| "slashes": true, | |
| } | |
| `) | |
| }) | |
| }) | |
Xet Storage Details
- Size:
- 2.08 kB
- Xet hash:
- 78ec90a2d0852d9e58ec03d2d3dd0058154837d543914b3f523332d18b8fd8e6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.