react-code-dataset / wp-calypso /client /state /data-layer /wpcom /concierge /initial /test /index.js
react-code-dataset / wp-calypso /client /state /data-layer /wpcom /concierge /initial /test /index.js
Download wp-calypso/client/state/data-layer/wpcom/concierge/initial/test/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.56 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/data-layer/wpcom/concierge/initial/test/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/data-layer/wpcom/concierge/initial/test/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/data-layer/wpcom/concierge/initial/test/index.js
1.56 kB
| import { CONCIERGE_INITIAL_REQUEST } from 'calypso/state/action-types'; | |
| import { updateConciergeInitial } from 'calypso/state/concierge/actions'; | |
| import { http } from 'calypso/state/data-layer/wpcom-http/actions'; | |
| import { | |
| conciergeInitialFetchError, | |
| fetchConciergeInitial, | |
| storeFetchedConciergeInitial, | |
| showConciergeInitialFetchError, | |
| } from '../'; | |
| describe( 'wpcom-api', () => { | |
| let originalRandomUUID; | |
| beforeAll( () => { | |
| originalRandomUUID = global.crypto.randomUUID; | |
| global.crypto.randomUUID = () => 'fake-uuid'; | |
| } ); | |
| afterAll( () => { | |
| global.crypto.randomUUID = originalRandomUUID; | |
| } ); | |
| describe( 'concierge', () => { | |
| test( 'fetchConciergeInitial()', () => { | |
| const action = { | |
| type: CONCIERGE_INITIAL_REQUEST, | |
| siteId: 999, | |
| }; | |
| expect( fetchConciergeInitial( action ) ).toEqual( | |
| http( | |
| { | |
| method: 'GET', | |
| path: '/concierge/initial', | |
| apiNamespace: 'wpcom/v2', | |
| query: { | |
| site_id: action.siteId, | |
| }, | |
| }, | |
| action | |
| ) | |
| ); | |
| } ); | |
| test( 'storeFetchedConciergeInitial()', () => { | |
| const mockInitial = { | |
| available_times: [ | |
| new Date( '2017-01-01 01:00:00' ), | |
| new Date( '2017-01-01 02:00:00' ), | |
| new Date( '2017-01-01 03:00:00' ), | |
| ], | |
| schedule_id: 18, | |
| }; | |
| expect( storeFetchedConciergeInitial( {}, mockInitial ) ).toEqual( | |
| updateConciergeInitial( mockInitial ) | |
| ); | |
| } ); | |
| test( 'showConciergeInitialFetchError()', () => { | |
| expect( showConciergeInitialFetchError() ).toEqual( conciergeInitialFetchError() ); | |
| } ); | |
| } ); | |
| } ); | |