Commit 6a0d2a25 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Add a couple of basic actions tests using snapshots

parent 22b402a5
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`calendar actions should create an action to notify of a failure fetching the calendar 1`] = `
Object {
"type": "CALENDAR_FAILURE",
}
`;
exports[`calendar actions should create an action to notify of a success fetch for the calendar 1`] = `
Object {
"payload": Object {
"eventList": Array [
Object {
"pk": 1,
},
],
},
"type": "CALENDAR_SUCCESS",
}
`;
exports[`calendar actions should create an action to refresh the calendar 1`] = `
Object {
"type": "CALENDAR_REFRESH",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`deeplinking actions should create an action to notify of a new deeplink 1`] = `
Object {
"payload": Object {
"url": "http://example.org",
},
"type": "DEEPLINKING_DEEPLINK",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`event actions should create an action to load an event 1`] = `
Object {
"payload": Object {
"pk": 1,
},
"type": "EVENT_EVENT",
}
`;
exports[`event actions should create an action to notify of a completed fetch of an event 1`] = `
Object {
"type": "EVENT_DONE",
}
`;
exports[`event actions should create an action to notify of a failure fetching an event 1`] = `
Object {
"type": "EVENT_FAILURE",
}
`;
exports[`event actions should create an action to notify of a success fetch of an event 1`] = `
Object {
"payload": Object {
"eventData": "eventData",
"eventRegistrations": "eventReg",
},
"type": "EVENT_SUCCESS",
}
`;
exports[`event actions should create an action to notify of that an event is fetching 1`] = `
Object {
"type": "EVENT_FETCHING",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`login actions should create an action for a successful login 1`] = `
Object {
"payload": Object {
"token": "token",
"username": "username",
},
"type": "LOGIN_SUCCESS",
}
`;
exports[`login actions should create an action for a successful user profile load 1`] = `
Object {
"payload": Object {
"displayName": "displayName",
"photo": "photo",
},
"type": "LOGIN_PROFILE_SUCCESS",
}
`;
exports[`login actions should create an action to load the user profile 1`] = `
Object {
"payload": Object {
"token": "token",
},
"type": "LOGIN_PROFILE",
}
`;
exports[`login actions should create an action to log the user in 1`] = `
Object {
"payload": Object {
"pass": "password",
"user": "username",
},
"type": "LOGIN_LOGIN",
}
`;
exports[`login actions should create an action to log the user out 1`] = `
Object {
"type": "LOGIN_LOGOUT",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`navigation actions should create an action to navigate back 1`] = `
Object {
"type": "NAVIGATE_BACK",
}
`;
exports[`navigation actions should create an action to navigate to a screen 1`] = `
Object {
"payload": Object {
"newSection": false,
"scene": "scene",
},
"type": "NAVIGATE_NAVIGATE",
}
`;
exports[`navigation actions should create an action to navigate to a screen 2`] = `
Object {
"payload": Object {
"newSection": true,
"scene": "scene",
},
"type": "NAVIGATE_NAVIGATE",
}
`;
exports[`navigation actions should create an action to update the drawer state 1`] = `
Object {
"payload": Object {
"drawerOpen": "state",
},
"type": "NAVIGATE_OPENDRAWER",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`pizza actions should create an action for a successful cancel the pizza order 1`] = `
Object {
"type": "PIZZA_CANCEL_SUCCESS",
}
`;
exports[`pizza actions should create an action for a successful pizza order creation 1`] = `
Object {
"payload": Object {
"order": "order",
},
"type": "PIZZA_ORDER_SUCCESS",
}
`;
exports[`pizza actions should create an action for a successful pizza retrieval 1`] = `
Object {
"payload": Object {
"event": "event",
"order": "order",
"pizzaList": "pizzaList",
},
"type": "PIZZA_SUCCESS",
}
`;
exports[`pizza actions should create an action to announce the pizza failure 1`] = `
Object {
"type": "PIZZA_FAILURE",
}
`;
exports[`pizza actions should create an action to announce the pizza fetching 1`] = `
Object {
"type": "PIZZA_FETCHING",
}
`;
exports[`pizza actions should create an action to cancel the pizza order 1`] = `
Object {
"type": "PIZZA_CANCEL",
}
`;
exports[`pizza actions should create an action to create the pizza order 1`] = `
Object {
"payload": Object {
"hasOrder": true,
"pk": 1,
},
"type": "PIZZA_ORDER",
}
`;
exports[`pizza actions should create an action to create the pizza order 2`] = `
Object {
"payload": Object {
"hasOrder": false,
"pk": 2,
},
"type": "PIZZA_ORDER",
}
`;
exports[`pizza actions should create an action to load the pizza list 1`] = `
Object {
"type": "PIZZA_PIZZALIST",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`navigation actions should create an action for a failed profile load 1`] = `
Object {
"type": "PROFILE_FAILURE",
}
`;
exports[`navigation actions should create an action for a successful profile load 1`] = `
Object {
"payload": Object {
"profileData": "profile",
},
"type": "PROFILE_SUCCESS",
}
`;
exports[`navigation actions should create an action for profile fetch 1`] = `
Object {
"type": "PROFILE_FETCHING",
}
`;
exports[`navigation actions should create an action to load a profile 1`] = `
Object {
"payload": Object {
"member": "me",
"token": "token",
},
"type": "PROFILE_PROFILE",
}
`;
exports[`navigation actions should create an action to load a profile 2`] = `
Object {
"payload": Object {
"member": 1,
"token": "abc123",
},
"type": "PROFILE_PROFILE",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`push notifications actions should create an action to invalidate the push token 1`] = `
Object {
"type": "PUSH_NOTIFICATIONS_INVALIDATE",
}
`;
exports[`push notifications actions should create an action to register the push token 1`] = `
Object {
"type": "PUSH_NOTIFICATIONS_REGISTER",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`registration actions should create an action to cancel the event registration 1`] = `
Object {
"payload": Object {
"registration": "registration",
},
"type": "REGISTRATION_CANCEL",
}
`;
exports[`registration actions should create an action to retrieve the event fields 1`] = `
Object {
"payload": Object {
"registration": "registration",
},
"type": "REGISTRATION_FIELDS",
}
`;
exports[`registration actions should create an action to show a failure 1`] = `
Object {
"type": "REGISTRATION_FAILURE",
}
`;
exports[`registration actions should create an action to show loading 1`] = `
Object {
"type": "REGISTRATION_FETCHING",
}
`;
exports[`registration actions should create an action to show success 1`] = `
Object {
"type": "REGISTRATION_SUCCESS",
}
`;
exports[`registration actions should create an action to show the event fields 1`] = `
Object {
"payload": Object {
"fields": "fields",
"registration": "registration",
},
"type": "REGISTRATION_SHOW_FIELDS",
}
`;
exports[`registration actions should create an action to start the event registration 1`] = `
Object {
"payload": Object {
"event": "event",
},
"type": "REGISTRATION_REGISTER",
}
`;
exports[`registration actions should create an action to update the event registration 1`] = `
Object {
"payload": Object {
"fields": "fields",
"registration": "registration",
},
"type": "REGISTRATION_UPDATE",
}
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`welcome actions should create an action to announce a failed load 1`] = `
Object {
"type": "WELCOME_FAILURE",
}
`;
exports[`welcome actions should create an action to announce a successful load 1`] = `
Object {
"payload": Object {
"eventList": "eventList",
},
"type": "WELCOME_SUCCESS",
}
`;
exports[`welcome actions should create an action to refresh the view 1`] = `
Object {
"type": "WELCOME_REFRESH",
}
`;
import * as actions from '../../app/actions/calendar';
describe('calendar actions', () => {
it('should expose the calendar actions', () => {
expect(actions.SUCCESS).toEqual('CALENDAR_SUCCESS');
expect(actions.FAILURE).toEqual('CALENDAR_FAILURE');
expect(actions.REFRESH).toEqual('CALENDAR_REFRESH');
});
it('should create an action to refresh the calendar', () => {
expect(actions.refresh()).toMatchSnapshot();
});
it('should create an action to notify of a failure fetching the calendar', () => {
expect(actions.failure()).toMatchSnapshot();
});
it('should create an action to notify of a success fetch for the calendar', () => {
expect(actions.success([{ pk: 1 }])).toMatchSnapshot();
});
});
\ No newline at end of file
import * as actions from '../../app/actions/deepLinking';
describe('deeplinking actions', () => {
it('should expose the deeplinking actions', () => {
expect(actions.DEEPLINK).toEqual('DEEPLINKING_DEEPLINK');
});
it('should create an action to notify of a new deeplink', () => {
expect(actions.deepLink('http://example.org')).toMatchSnapshot();
});
});
\ No newline at end of file
import * as actions from '../../app/actions/event';
describe('event actions', () => {
it('should expose the event actions', () => {
expect(actions.SUCCESS).toEqual('EVENT_SUCCESS');
expect(actions.FETCHING).toEqual('EVENT_FETCHING');
expect(actions.FAILURE).toEqual('EVENT_FAILURE');
expect(actions.EVENT).toEqual('EVENT_EVENT');
expect(actions.DONE).toEqual('EVENT_DONE');
});
it('should create an action to load an event', () => {
expect(actions.event(1)).toMatchSnapshot();
});
it('should create an action to notify of that an event is fetching', () => {
expect(actions.fetching()).toMatchSnapshot();
});
it('should create an action to notify of a failure fetching an event', () => {
expect(actions.failure()).toMatchSnapshot();
});
it('should create an action to notify of a success fetch of an event', () => {
expect(actions.success('eventData', 'eventReg')).toMatchSnapshot();
});
it('should create an action to notify of a completed fetch of an event', () => {
expect(actions.done()).toMatchSnapshot();
});
});
\ No newline at end of file
import * as actions from '../../app/actions/login';
describe('login actions', () => {
it('should expose the login actions', () => {
expect(actions.SUCCESS).toEqual('LOGIN_SUCCESS');
expect(actions.LOGIN).toEqual('LOGIN_LOGIN');
expect(actions.LOGOUT).toEqual('LOGIN_LOGOUT');
expect(actions.PROFILE).toEqual('LOGIN_PROFILE');
expect(actions.PROFILE_SUCCESS).toEqual('LOGIN_PROFILE_SUCCESS');
});
it('should create an action to log the user in', () => {
expect(actions.login('username', 'password')).toMatchSnapshot();
});
it('should create an action for a successful login', () => {
expect(actions.success('username', 'token')).toMatchSnapshot();
});
it('should create an action to log the user out', () => {
expect(actions.logout()).toMatchSnapshot();
});
it('should create an action to load the user profile', () => {
expect(actions.profile('token')).toMatchSnapshot();
});
it('should create an action for a successful user profile load', () => {
expect(actions.profileSuccess('displayName', 'photo')).toMatchSnapshot();
});
});
\ No newline at end of file
import * as actions from '../../app/actions/navigation';
describe('navigation actions', () => {
it('should expose the navigation actions', () => {
expect(actions.NAVIGATE).toEqual('NAVIGATE_NAVIGATE');
expect(actions.BACK).toEqual('NAVIGATE_BACK');
expect(actions.OPENDRAWER).toEqual('NAVIGATE_OPENDRAWER');
});
it('should create an action to navigate to a screen', () => {
expect(actions.navigate('scene')).toMatchSnapshot();
expect(actions.navigate('scene', true)).toMatchSnapshot();
});
it('should create an action to navigate back', () => {
expect(actions.back()).toMatchSnapshot();
});
it('should create an action to update the drawer state', () => {
expect(actions.updateDrawer('state')).toMatchSnapshot();
});
});
\ No newline at end of file
import * as actions from '../../app/actions/pizza';
describe('pizza actions', () => {
it('should expose the pizza actions', () => {
expect(actions.PIZZA).toEqual('PIZZA_PIZZALIST');
expect(actions.FETCHING).toEqual('PIZZA_FETCHING');
expect(actions.SUCCESS).toEqual('PIZZA_SUCCESS');
expect(actions.FAILURE).toEqual('PIZZA_FAILURE');
expect(actions.CANCEL).toEqual('PIZZA_CANCEL');
expect(actions.CANCEL_SUCCESS).toEqual('PIZZA_CANCEL_SUCCESS');
expect(actions.ORDER).toEqual('PIZZA_ORDER');
expect(actions.ORDER_SUCCESS).toEqual('PIZZA_ORDER_SUCCESS');
});
it('should create an action to load the pizza list', () => {
expect(actions.retrievePizzaInfo()).toMatchSnapshot();
});
it('should create an action for a successful pizza retrieval', () => {
expect(actions.success('event', 'order', 'pizzaList')).toMatchSnapshot();
});
it('should create an action to announce the pizza fetching', () => {
expect(actions.fetching()).toMatchSnapshot();
});
it('should create an action to announce the pizza failure', () => {
expect(actions.failure()).toMatchSnapshot();
});
it('should create an action to cancel the pizza order', () => {
expect(actions.cancelOrder()).toMatchSnapshot();
});
it('should create an action for a successful cancel the pizza order', () => {
expect(actions.cancelSuccess()).toMatchSnapshot();
});
it('should create an action to create the pizza order', () => {
expect(actions.orderPizza(1, true)).toMatchSnapshot();
expect(actions.orderPizza(2, false)).toMatchSnapshot();
});
it('should create an action for a successful pizza order creation', () => {
expect(actions.orderSuccess('order')).toMatchSnapshot();
});
});
\ No newline at end of file
import * as actions from '../../app/actions/profile';
describe('navigation actions', () => {
it('should expose the navigation actions', () => {
expect(actions.PROFILE).toEqual('PROFILE_PROFILE');
expect(actions.FETCHING).toEqual('PROFILE_FETCHING');
expect(actions.SUCCESS).toEqual('PROFILE_SUCCESS');
expect(actions.FAILURE).toEqual('PROFILE_FAILURE');
});
it('should create an action to load a profile', () => {
expect(actions.profile('token')).toMatchSnapshot();
expect(actions.profile('abc123', 1)).toMatchSnapshot();
});
it('should create an action for profile fetch', () => {
expect(actions.fetching()).toMatchSnapshot();
});
it('should create an action for a successful profile load', () => {
expect(actions.success('profile')).toMatchSnapshot();
});
it('should create an action for a failed profile load', () => {
expect(actions.failure()).toMatchSnapshot();
});
});
\ No newline at end of file
import * as actions from '../../app/actions/pushNotifications';
describe('push notifications actions', () => {
it('should expose the push notifications actions', () => {
expect(actions.REGISTER).toEqual('PUSH_NOTIFICATIONS_REGISTER');
expect(actions.INVALIDATE).toEqual('PUSH_NOTIFICATIONS_INVALIDATE');
});
it('should create an action to register the push token', () => {
expect(actions.register()).toMatchSnapshot();
});
it('should create an action to invalidate the push token', () => {
expect(actions.invalidate()).toMatchSnapshot();
});
});
\ No newline at end of file
import * as actions from '../../app/actions/registration';
describe('registration actions', () => {
it('should expose the registration actions', () => {
expect(actions.REGISTER).toEqual('REGISTRATION_REGISTER');
expect(actions.UPDATE).toEqual('REGISTRATION_UPDATE');
expect(actions.CANCEL).toEqual('REGISTRATION_CANCEL');
expect(actions.FIELDS).toEqual('REGISTRATION_FIELDS');
expect(actions.LOADING).toEqual('REGISTRATION_FETCHING');
expect(actions.FAILURE).toEqual('REGISTRATION_FAILURE');