Download wp-calypso/client/state/admin-menu/test/selectors.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/admin-menu/test/selectors.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/admin-menu/test/selectors.js
-
curl -L -o selectors.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/admin-menu/test/selectors.js
1.16 kB
| import deepFreeze from 'deep-freeze'; | |
| import { getAdminMenu } from '../selectors'; | |
| import menuFixture from './fixture/menu-fixture'; | |
| const frozenFixture = deepFreeze( menuFixture ); | |
| describe( 'selectors', () => { | |
| describe( '#getAdminMenu', () => { | |
| test( 'returns null when state is undefined', () => { | |
| const state = {}; | |
| expect( getAdminMenu( state, 123456 ) ).toEqual( null ); | |
| } ); | |
| test( 'returns null when siteId is not provided', () => { | |
| const state = { | |
| adminMenu: { | |
| menus: { | |
| 56789: frozenFixture, | |
| }, | |
| }, | |
| }; | |
| expect( getAdminMenu( state ) ).toEqual( null ); | |
| } ); | |
| test( 'returns null data when requested siteId key is not present', () => { | |
| const state = { | |
| adminMenu: { | |
| menus: { | |
| 56789: frozenFixture, | |
| }, | |
| }, | |
| }; | |
| expect( getAdminMenu( state, 12345 ) ).toEqual( null ); | |
| } ); | |
| test( 'returns menu data when siteId is present', () => { | |
| const state = { | |
| adminMenu: { | |
| menus: { | |
| 56789: {}, | |
| 12345: frozenFixture, | |
| 84649: {}, | |
| 95538: {}, | |
| }, | |
| }, | |
| }; | |
| expect( getAdminMenu( state, 12345 ) ).toEqual( frozenFixture ); | |
| } ); | |
| } ); | |
| } ); | |