it('Should return the initial state', () => { expect( reducer(undefined, {}) ).toEqual( { topics: [], newTopic: '' } ); });
it('Should add a new topic to an empty initial state', () => { const topic = 'A time machine'; const id = md5.hash(topic); expect( reducer(undefined, { type: types.CREATE_TOPIC_REQUEST, id, count: 1, text: topic }) ).toEqual({ topics: [ { id, count: 1, text: topic } ], newTopic: '' }); });