Download react-hook-form/src/__tests__/logic/getResolverOptions.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/logic/getResolverOptions.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/logic/getResolverOptions.test.ts
-
curl -L -o getResolverOptions.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-hook-form/src/__tests__/logic/getResolverOptions.test.ts
1.42 kB
| import type { InternalFieldName } from '../..'; | |
| import getResolverOptions from '../../logic/getResolverOptions'; | |
| describe('getFielfs', () => { | |
| it('should return fields from `fieldsNames` and `fieldsRef`', () => { | |
| const fieldNames: Set<InternalFieldName> = new Set(['test.sub', 'test1']); | |
| const fieldsRef: any = { | |
| test: { | |
| sub: { | |
| _f: { | |
| ref: { name: 'test.sub', value: 'test' }, | |
| name: 'test.sub', | |
| value: 'test', | |
| }, | |
| }, | |
| }, | |
| test1: { | |
| _f: { | |
| ref: { name: 'test1', value: 'test1' }, | |
| name: 'test1', | |
| value: 'test1', | |
| }, | |
| }, | |
| }; | |
| expect(getResolverOptions(fieldNames, fieldsRef, undefined, true)) | |
| .toMatchInlineSnapshot(` | |
| { | |
| "criteriaMode": undefined, | |
| "fields": { | |
| "test": { | |
| "sub": { | |
| "name": "test.sub", | |
| "ref": { | |
| "name": "test.sub", | |
| "value": "test", | |
| }, | |
| "value": "test", | |
| }, | |
| }, | |
| "test1": { | |
| "name": "test1", | |
| "ref": { | |
| "name": "test1", | |
| "value": "test1", | |
| }, | |
| "value": "test1", | |
| }, | |
| }, | |
| "names": [ | |
| "test.sub", | |
| "test1", | |
| ], | |
| "shouldUseNativeValidation": true, | |
| } | |
| `); | |
| }); | |
| }); | |