react-code-dataset / wp-calypso /client /jetpack-cloud /sections /partner-portal /lib /test /value-to-enum.ts
react-code-dataset / wp-calypso /client /jetpack-cloud /sections /partner-portal /lib /test /value-to-enum.ts
Download wp-calypso/client/jetpack-cloud/sections/partner-portal/lib/test/value-to-enum.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 591 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/jetpack-cloud/sections/partner-portal/lib/test/value-to-enum.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/jetpack-cloud/sections/partner-portal/lib/test/value-to-enum.ts
-
curl -L -o value-to-enum.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/jetpack-cloud/sections/partner-portal/lib/test/value-to-enum.ts
591 Bytes
| import valueToEnum from '../value-to-enum'; | |
| enum TestEnum { | |
| Value1 = 'Lions', | |
| Value2 = 'Tigers', | |
| Value3 = 'Bears', | |
| Value4 = 'George Takei', | |
| } | |
| describe( 'valueToEnum', () => { | |
| it( 'returns the appropriate enum value if one is found', () => { | |
| const result = valueToEnum( TestEnum, 'Tigers', TestEnum.Value4 ); | |
| expect( result ).toBe( TestEnum.Value2 ); | |
| } ); | |
| it( 'returns the supplied fallback value if an enum value is not found', () => { | |
| const result = valueToEnum( TestEnum, 'The Spanish Inquisition', TestEnum.Value4 ); | |
| expect( result ).toBe( TestEnum.Value4 ); | |
| } ); | |
| } ); | |