Download wp-calypso/client/state/concierge/next-appointment/test/reducer.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/concierge/next-appointment/test/reducer.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/concierge/next-appointment/test/reducer.js
-
curl -L -o reducer.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/concierge/next-appointment/test/reducer.js
1.05 kB
| import { CONCIERGE_INITIAL_REQUEST, CONCIERGE_INITIAL_UPDATE } from 'calypso/state/action-types'; | |
| import { nextAppointment } from '../reducer'; | |
| describe( 'concierge/nextAppointment/reducer', () => { | |
| const mockAppointmentDetails = { | |
| nextAppointment: { | |
| id: 1, | |
| begin_timestamp: 2, | |
| end_timestamp: 3, | |
| }, | |
| }; | |
| const requestAction = { | |
| type: CONCIERGE_INITIAL_REQUEST, | |
| }; | |
| const updateAction = { | |
| type: CONCIERGE_INITIAL_UPDATE, | |
| initial: mockAppointmentDetails, | |
| }; | |
| describe( 'nextAppointment', () => { | |
| test( 'should default to null.', () => { | |
| expect( nextAppointment( undefined, {} ) ).toBeNull(); | |
| } ); | |
| test( 'should be null on receiving the request action.', () => { | |
| const state = mockAppointmentDetails; | |
| expect( nextAppointment( state, requestAction ) ).toBeNull(); | |
| } ); | |
| test( 'should be the next appointment data on receiving the update action.', () => { | |
| const state = []; | |
| expect( nextAppointment( state, updateAction ) ).toEqual( | |
| mockAppointmentDetails.nextAppointment | |
| ); | |
| } ); | |
| } ); | |
| } ); | |