Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('addChat()', ({ test }) => {
- test('with no arguments', ({ same, end}) => {
- const msg = 'should add default chat message';
- const actual = pipe(
- () => reducer(undefined, addChat()),
- // make sure the id and timestamp are there,
- // but we don't care about the values
- state => {
- const chat = state.chatLog[0];
- chat.id = !!chat.id;
- chat.timeStamp = !!chat.timeStamp;
- return state;
- }
- )();
- const expected = Object.assign(createState(), {
- chatLog: [{
- id: true,
- user: 'Anonymous',
- msg: '',
- timeStamp: true
- }]
- });
- same(actual, expected, msg);
- end();
- });
- test('with all arguments', ({ same, end}) => {
- const msg = 'should add correct chat message';
- const actual = reducer(undefined, addChat({
- id: 1,
- user: '@JS_Cheerleader',
- msg: 'Yay!',
- timeStamp: 1472322852682
- }));
- const expected = Object.assign(createState(), {
- chatLog: [{
- id: 1,
- user: '@JS_Cheerleader',
- msg: 'Yay!',
- timeStamp: 1472322852682
- }]
- });
- same(actual, expected, msg);
- end();
- });
- });
Add Comment
Please, Sign In to add comment