Download wp-calypso/client/state/ui/test/actions.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.63 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/test/actions.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/ui/test/actions.js
-
curl -L -o actions.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/ui/test/actions.js
1.63 kB
| import { | |
| NOTIFICATIONS_PANEL_TOGGLE, | |
| MOST_RECENTLY_SELECTED_SITE_SET, | |
| SECTION_SET, | |
| SELECTED_SITE_SET, | |
| } from 'calypso/state/action-types'; | |
| import { | |
| setAllSitesSelected, | |
| setSection, | |
| setSelectedSiteId, | |
| toggleNotificationsPanel, | |
| } from '../actions'; | |
| describe( 'actions', () => { | |
| describe( 'setAllSitesSelected()', () => { | |
| test( 'should dispatch actions for clearing the selected site ID', () => { | |
| const dispatch = jest.fn(); | |
| setAllSitesSelected()( dispatch ); | |
| expect( dispatch ).not.toHaveBeenCalledWith( { | |
| type: MOST_RECENTLY_SELECTED_SITE_SET, | |
| siteId: null, | |
| } ); | |
| expect( dispatch ).toHaveBeenCalledWith( { | |
| type: SELECTED_SITE_SET, | |
| siteId: null, | |
| } ); | |
| } ); | |
| } ); | |
| describe( 'setSection()', () => { | |
| test( 'should return an action object with the section specified', () => { | |
| const section = { name: 'me' }; | |
| expect( setSection( section ) ).toEqual( { | |
| type: SECTION_SET, | |
| section, | |
| } ); | |
| } ); | |
| } ); | |
| describe( 'setSelectedSiteId()', () => { | |
| test( 'should dispatch actions for selected site IDs', () => { | |
| const siteId = 2916284; | |
| const dispatch = jest.fn(); | |
| setSelectedSiteId( siteId )( dispatch ); | |
| expect( dispatch ).toHaveBeenCalledWith( { | |
| type: MOST_RECENTLY_SELECTED_SITE_SET, | |
| siteId, | |
| } ); | |
| expect( dispatch ).toHaveBeenCalledWith( { | |
| type: SELECTED_SITE_SET, | |
| siteId, | |
| } ); | |
| } ); | |
| } ); | |
| describe( 'toggleNotificationsPanel()', () => { | |
| test( 'should return an action object with just the action type', () => { | |
| expect( toggleNotificationsPanel() ).toEqual( { | |
| type: NOTIFICATIONS_PANEL_TOGGLE, | |
| } ); | |
| } ); | |
| } ); | |
| } ); | |