Skip to content

Commit

Permalink
add parseUrl() port test
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Jul 19, 2024
1 parent a6bb847 commit 6c7674d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions vike/utils/parseUrl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,42 @@ describe('parseUrl', () => {
"searchOriginal": null,
}
`)

// Port
expect(parseUrl('http://localhost:3000/base/hello', '/base')).toMatchInlineSnapshot(`
{
"hasBaseServer": true,
"hash": "",
"hashOriginal": null,
"hostname": "localhost",
"href": "http://localhost:3000/hello",
"origin": "http://localhost:3000",
"pathname": "/hello",
"pathnameOriginal": "/base/hello",
"port": 3000,
"protocol": "http://",
"search": {},
"searchAll": {},
"searchOriginal": null,
}
`)
expect(parseUrl('https://example.org:0', '/')).toMatchInlineSnapshot(`
{
"hasBaseServer": true,
"hash": "",
"hashOriginal": null,
"hostname": "example.org",
"href": "https://example.org:0/",
"origin": "https://example.org:0",
"pathname": "/",
"pathnameOriginal": "",
"port": 0,
"protocol": "https://",
"search": {},
"searchAll": {},
"searchOriginal": null,
}
`)
})

it('hash', () => {
Expand Down

0 comments on commit 6c7674d

Please sign in to comment.