Download wp-calypso/client/state/ui/language/test/reducer.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 782 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/language/test/reducer.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/ui/language/test/reducer.js
-
curl -L -o reducer.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/language/test/reducer.js
782 Bytes
| import { LOCALE_SET } from 'calypso/state/action-types'; | |
| import reducer from '../reducer'; | |
| describe( 'reducer', () => { | |
| test( 'returns default state with undefined state and empty action', () => { | |
| expect( reducer( undefined, {} ) ).toEqual( { localeSlug: 'en', localeVariant: null } ); | |
| } ); | |
| test( 'returns previous state with empty action', () => { | |
| const state = { localeSlug: 'de', localeVariant: 'de_formal' }; | |
| expect( reducer( state, {} ) ).toBe( state ); | |
| } ); | |
| test( 'returns new state with valid slug', () => { | |
| const state = { localeSlug: 'en', localeVariant: 'en' }; | |
| const action = { type: LOCALE_SET, localeSlug: 'de', localeVariant: 'de_formal' }; | |
| expect( reducer( state, action ) ).toEqual( { localeSlug: 'de', localeVariant: 'de_formal' } ); | |
| } ); | |
| } ); | |