silverwolf-x/project / packages /next /src /client /components /router-reducer /create-href-from-url.test.ts
silverwolf-x's picture
download
raw
840 Bytes
import { createHrefFromUrl } from './create-href-from-url'
describe('createHrefFromUrl', () => {
it('returns a string', () => {
const url = new URL('https://example.com/')
expect(createHrefFromUrl(url)).toBe('/')
})
it('adds hash', () => {
const url = new URL('https://example.com/#hash')
expect(createHrefFromUrl(url)).toBe('/#hash')
})
it('adds searchParams', () => {
const url = new URL('https://example.com/?a=1&b=2')
expect(createHrefFromUrl(url)).toBe('/?a=1&b=2')
})
it('adds pathname', () => {
const url = new URL('https://example.com/path')
expect(createHrefFromUrl(url)).toBe('/path')
})
it('adds pathname, searchParams, and hash', () => {
const url = new URL('https://example.com/path?a=1&b=2#hash')
expect(createHrefFromUrl(url)).toBe('/path?a=1&b=2#hash')
})
})

Xet Storage Details

Size:
840 Bytes
·
Xet hash:
5f8e85f4c901b1c0585f08b596785dd1def1e9c0df437de843f642ac22f0f096

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.