File size: 3,480 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
import {
CONCIERGE_APPOINTMENT_CANCEL,
CONCIERGE_APPOINTMENT_CREATE,
CONCIERGE_APPOINTMENT_DETAILS_REQUEST,
CONCIERGE_APPOINTMENT_DETAILS_UPDATE,
CONCIERGE_APPOINTMENT_RESCHEDULE,
CONCIERGE_INITIAL_REQUEST,
CONCIERGE_INITIAL_UPDATE,
CONCIERGE_SIGNUP_FORM_UPDATE,
CONCIERGE_UPDATE_BOOKING_STATUS,
} from 'calypso/state/action-types';
import {
bookConciergeAppointment,
cancelConciergeAppointment,
rescheduleConciergeAppointment,
requestConciergeAppointmentDetails,
updateConciergeAppointmentDetails,
requestConciergeInitial,
updateConciergeInitial,
updateConciergeBookingStatus,
updateConciergeSignupForm,
} from '../actions';
describe( 'state/concierge', () => {
describe( 'actions', () => {
test( 'bookConciergeAppointment()', () => {
const scheduleId = 123;
const beginTimestamp = 1234567890;
const customerId = 1;
const siteId = 2;
const meta = { test: 'testing' };
expect(
bookConciergeAppointment( scheduleId, beginTimestamp, customerId, siteId, meta )
).toEqual( {
type: CONCIERGE_APPOINTMENT_CREATE,
scheduleId,
beginTimestamp,
customerId,
siteId,
meta,
} );
} );
test( 'cancelConciergeAppointment()', () => {
const scheduleId = 123;
const appointmentId = 1;
expect( cancelConciergeAppointment( scheduleId, appointmentId ) ).toEqual( {
type: CONCIERGE_APPOINTMENT_CANCEL,
scheduleId,
appointmentId,
} );
} );
test( 'rescheduleConciergeAppointment()', () => {
const scheduleId = 123;
const beginTimestamp = 1234567890;
const appointmentId = 1;
const appointmentDetails = { meta: { timezone: 'UTC' } };
expect(
rescheduleConciergeAppointment(
scheduleId,
appointmentId,
beginTimestamp,
appointmentDetails
)
).toEqual( {
type: CONCIERGE_APPOINTMENT_RESCHEDULE,
scheduleId,
appointmentId,
beginTimestamp,
appointmentDetails,
} );
} );
test( 'requestConciergeInitial()', () => {
const siteId = 456;
expect( requestConciergeInitial( siteId ) ).toEqual( {
type: CONCIERGE_INITIAL_REQUEST,
siteId,
} );
} );
test( 'updateConciergeInitial()', () => {
const initial = {
availableTimes: [ 111, 222, 333 ],
scheduleId: 123,
};
expect( updateConciergeInitial( initial ) ).toEqual( {
type: CONCIERGE_INITIAL_UPDATE,
initial,
} );
} );
test( 'updateConciergeSignupForm()', () => {
const signupForm = { timezone: 'UTC', message: 'hello there' };
expect( updateConciergeSignupForm( signupForm ) ).toEqual( {
type: CONCIERGE_SIGNUP_FORM_UPDATE,
signupForm,
} );
} );
test( 'updateConciergeBookingStatus()', () => {
const status = 'booking';
expect( updateConciergeBookingStatus( status ) ).toEqual( {
type: CONCIERGE_UPDATE_BOOKING_STATUS,
status,
} );
} );
test( 'requestConciergeAppointmentDetails()', () => {
const scheduleId = 1;
const appointmentId = 2;
expect( requestConciergeAppointmentDetails( scheduleId, appointmentId ) ).toEqual( {
type: CONCIERGE_APPOINTMENT_DETAILS_REQUEST,
scheduleId,
appointmentId,
} );
} );
test( 'updateConciergeAppointmentDetails()', () => {
const appointmentId = 1;
const appointmentDetails = { id: appointmentId };
expect( updateConciergeAppointmentDetails( appointmentId, appointmentDetails ) ).toEqual( {
type: CONCIERGE_APPOINTMENT_DETAILS_UPDATE,
appointmentId,
appointmentDetails,
} );
} );
} );
} );
|