Download react-hook-form/src/__tests__/logic/getNodeParentName.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 713 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/src/__tests__/logic/getNodeParentName.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-hook-form/src/__tests__/logic/getNodeParentName.test.ts
-
curl -L -o getNodeParentName.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-hook-form/src/__tests__/logic/getNodeParentName.test.ts
713 Bytes
| import getNodeParentName from '../../logic/getNodeParentName'; | |
| describe('getNodeParentName', () => { | |
| it('should return parent name when name is field array', () => { | |
| expect(getNodeParentName('test.0')).toBe('test'); | |
| expect(getNodeParentName('test1.1')).toBe('test1'); | |
| expect(getNodeParentName('test.0.data.0')).toBe('test'); | |
| expect(getNodeParentName('test.data.0')).toBe('test.data'); | |
| expect(getNodeParentName('test.1st')).toBe('test.1st'); | |
| }); | |
| it('should return empty string when name is not field array', () => { | |
| expect(getNodeParentName('test')).toBe('test'); | |
| expect(getNodeParentName('test0')).toBe('test0'); | |
| expect(getNodeParentName('te1st')).toBe('te1st'); | |
| }); | |
| }); | |