Download next.js/packages/next/src/shared/lib/router/utils/is-dynamic.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/router/utils/is-dynamic.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/shared/lib/router/utils/is-dynamic.test.ts
-
curl -L -o is-dynamic.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/shared/lib/router/utils/is-dynamic.test.ts
1.57 kB
| import { isDynamicRoute } from './is-dynamic' | |
| describe('isDynamicRoute', () => { | |
| describe('strict', () => { | |
| it('should return true for dynamic routes', () => { | |
| expect(isDynamicRoute('/blog/[...slug]')).toBe(true) | |
| }) | |
| it('should return false for static routes', () => { | |
| expect(isDynamicRoute('/blog/123')).toBe(false) | |
| }) | |
| it('should return true for dynamic routes with a suffix', () => { | |
| expect(isDynamicRoute('/blog/[slug].json')).toBe(false) | |
| }) | |
| it('should return false for dynamic routes with a prefix', () => { | |
| expect(isDynamicRoute('/blog/$d$slug$[...slug]/')).toBe(false) | |
| }) | |
| it('should return false for dynamic routes with a suffix and prefix', () => { | |
| expect(isDynamicRoute('/blog/$d$slug$[...slug].json')).toBe(false) | |
| }) | |
| }) | |
| describe('non-strict', () => { | |
| it('should return true for dynamic routes', () => { | |
| expect(isDynamicRoute('/blog/[...slug]', false)).toBe(true) | |
| }) | |
| it('should return false for static routes', () => { | |
| expect(isDynamicRoute('/blog/123', false)).toBe(false) | |
| }) | |
| it('should return true for dynamic routes with a suffix', () => { | |
| expect(isDynamicRoute('/blog/[slug].json', false)).toBe(true) | |
| }) | |
| it('should return true for dynamic routes with a prefix', () => { | |
| expect(isDynamicRoute('/blog/$d$slug$[...slug]/', false)).toBe(true) | |
| }) | |
| it('should return true for dynamic routes with a suffix and prefix', () => { | |
| expect(isDynamicRoute('/blog/$d$slug$[...slug].json', false)).toBe(true) | |
| }) | |
| }) | |
| }) | |