Download wp-calypso/client/state/ui/preview/test/selectors.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 985 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/preview/test/selectors.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/ui/preview/test/selectors.js
-
curl -L -o selectors.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/preview/test/selectors.js
985 Bytes
| import { getPreviewSiteId } from '../selectors'; | |
| describe( 'getPreviewSiteId', () => { | |
| const currentPreviewSiteId = 123; | |
| const selectedSiteId = 456; | |
| test( 'should return the selected site id when not in "All My Sites" mode', () => { | |
| const state = { | |
| ui: { | |
| preview: { | |
| currentPreviewSiteId, | |
| }, | |
| selectedSiteId, | |
| }, | |
| }; | |
| expect( getPreviewSiteId( state ) ).toEqual( selectedSiteId ); | |
| } ); | |
| test( 'should return the current preview site id when in "All My Sites" mode', () => { | |
| const state = { | |
| ui: { | |
| preview: { | |
| currentPreviewSiteId, | |
| }, | |
| selectedSiteId: null, | |
| }, | |
| }; | |
| expect( getPreviewSiteId( state ) ).toEqual( currentPreviewSiteId ); | |
| } ); | |
| test( 'should return null when in "All My Sites" mode and the current preview site id is unset', () => { | |
| const state = { | |
| ui: { | |
| preview: { | |
| currentPreviewSiteId: null, | |
| }, | |
| selectedSiteId: null, | |
| }, | |
| }; | |
| expect( getPreviewSiteId( state ) ).toBeNull(); | |
| } ); | |
| } ); | |