fix tests

This commit is contained in:
Vyrtsev Mikhail
2019-04-20 20:58:58 +03:00
parent 68294fd3d2
commit 7e84b356a2
4 changed files with 27 additions and 6 deletions
+6 -4
View File
@@ -4,10 +4,10 @@ import { setCollapse } from './actions';
import { THREAD_SET_COLLAPSE } from './types';
describe('collapsedThreads', () => {
const comment = { id: 'some-id' } as Comment;
it('should set collapsed to true', () => {
const state = { collapsedThreads: {} };
const comment = { id: 'some-id' } as Comment;
const node = { comment, replies: [] };
const state = { collapsedThreads: {}, comments: [node] };
const dispatch = jest.fn();
const getState = jest.fn(() => state) as any;
@@ -20,9 +20,11 @@ describe('collapsedThreads', () => {
});
it('should collapse toggled', () => {
const comment = { id: 'some-id' } as Comment;
const node = { comment, replies: [] };
const dispatch = jest.fn();
const getState = jest.fn();
getState.mockReturnValue({ collapsedThreads: { 'some-id': true } });
getState.mockReturnValue({ collapsedThreads: { 'some-id': true }, comments: [node] });
setCollapse(comment.id)(dispatch, getState, undefined);
expect(dispatch).toBeCalledWith({