react-code-dataset / next.js /packages /next /src /client /components /router-reducer /get-segment-value.test.ts
Download next.js/packages/next/src/client/components/router-reducer/get-segment-value.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 496 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/client/components/router-reducer/get-segment-value.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/client/components/router-reducer/get-segment-value.test.ts
-
curl -L -o get-segment-value.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/client/components/router-reducer/get-segment-value.test.ts
496 Bytes
| import { getSegmentValue } from './reducers/get-segment-value' | |
| describe('getSegmentValue', () => { | |
| it('should support string segment', () => { | |
| expect(getSegmentValue('foo')).toEqual('foo') | |
| }) | |
| it('should support dynamic segment', () => { | |
| expect(getSegmentValue(['slug', 'hello-world', 'd'])).toEqual('hello-world') | |
| }) | |
| it('should support catch all segment', () => { | |
| expect(getSegmentValue(['slug', 'blog/hello-world', 'c'])).toEqual( | |
| 'blog/hello-world' | |
| ) | |
| }) | |
| }) | |