Download wp-calypso/client/state/selectors/test/get-jetpack-modules.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 834 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/test/get-jetpack-modules.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/selectors/test/get-jetpack-modules.js
-
curl -L -o get-jetpack-modules.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/test/get-jetpack-modules.js
834 Bytes
| import getJetpackModules from 'calypso/state/selectors/get-jetpack-modules'; | |
| import { moduleData as MODULE_DATA_FIXTURE } from './fixtures/jetpack-modules'; | |
| describe( 'getJetpackModules()', () => { | |
| test( 'should return data for all modules for a known site', () => { | |
| const stateIn = { | |
| jetpack: { | |
| modules: { | |
| items: { | |
| 123456: MODULE_DATA_FIXTURE, | |
| }, | |
| }, | |
| }, | |
| }; | |
| const siteId = 123456; | |
| const output = getJetpackModules( stateIn, siteId ); | |
| expect( output ).toEqual( MODULE_DATA_FIXTURE ); | |
| } ); | |
| test( 'should return null for an unknown site', () => { | |
| const stateIn = { | |
| jetpack: { | |
| modules: { | |
| items: { | |
| 654321: MODULE_DATA_FIXTURE, | |
| }, | |
| }, | |
| }, | |
| }; | |
| const siteId = 123456; | |
| const output = getJetpackModules( stateIn, siteId ); | |
| expect( output ).toBeNull(); | |
| } ); | |
| } ); | |