Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('creates a comment in the store and sends request to api', async() => {
const data = {
commentsStore: {},
commentForm: { author: 'Alexey', text: 'Random comment' },
};
const store = createStoreFromState(fromJS(data));
const response = {
entities: {
comments: {
1: { id: 1, author: 'Alexey', text: 'Random comment' },
},
},
};
mockCalls(null, response);
await store.dispatch(actions.createComment());
expect(store.getActions()).toMatchSnapshot();
});
});
it('adds AddProps to a component', () => {
const state = initialState.mergeDeep({
commentForm: {
author: 'Alexey',
text: 'Random comment',
},
});
const store = createStoreFromState(state);
const Component = withAddProps(Mock);
const tree = renderer.create();
expect(tree).toMatchSnapshot();
});
});
it('adds props to Index component', () => {
const state = initialState.mergeDeep({
commentsStore: {
2: { id: 2, author: 'Justin', text: 'Another random comment' },
3: { id: 3, author: 'John', text: 'Yet another random comment' },
1: { id: 1, author: 'Alexey', text: 'Just some random comment' },
},
});
const store = createStoreFromState(state);
const Component = withIndexProps(Mock);
const tree = renderer.create();
expect(tree).toMatchSnapshot();
});
});