silverwolf-x/project / packages /next /src /server /lib /router-utils /decode-path-params.test.ts
silverwolf-x's picture
download
raw
725 Bytes
/* eslint-env jest */
import { decodePathParams } from './decode-path-params'
describe('decoding path params', () => {
it('should decode path params', () => {
const decodedPathParams = decodePathParams('sticks%20%26%20stones')
expect(decodedPathParams).toBe('sticks & stones')
})
it('should throw an error when the path param is improperly encoded', () => {
try {
// The segment %ZZ is an invalid percent-encoded sequence
// because %ZZ does not represent a valid hexadecimal character.
decodePathParams('sticks%ZZ%ZZ%ZZstones')
} catch (error) {
expect(error).toBeInstanceOf(Error)
expect((error as Error).message).toBe('Failed to decode path param(s).')
}
})
})

Xet Storage Details

Size:
725 Bytes
·
Xet hash:
90873e86f69603e36432ccf47217ea49f58a8837a19110a7f0f507385a73629d

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