rsnext/test/unit/validate-url.test.ts

14 lines
405 B
TypeScript
Raw Normal View History

import { validateURL } from 'next/dist/server/app-render/validate-url'
describe('validateUrl', () => {
it('should return valid pathname', () => {
expect(validateURL('/')).toBe('/')
expect(validateURL('/abc')).toBe('/abc')
})
it('should throw for invalid pathname', () => {
expect(() => validateURL('//**y/\\')).toThrow()
expect(() => validateURL('//google.com')).toThrow()
})
})