Skip to content

Instantly share code, notes, and snippets.

@sonicoder86
Created April 15, 2020 18:27
Show Gist options
  • Save sonicoder86/0e8a8a5b071d2e4c00f2d4c9984dea23 to your computer and use it in GitHub Desktop.
Save sonicoder86/0e8a8a5b071d2e4c00f2d4c9984dea23 to your computer and use it in GitHub Desktop.
React Testing Crash Course - part 15
it('should set info coming from endpoint', async () => {
const commit = jest.fn();
jest.spyOn(axios, 'post').mockImplementation(() => ({
body: 'Modified by post'
}));
await onModify({ commit }, 'Modified by click');
expect(commit).toHaveBeenCalledWith('modify', { info: 'Modified by post' });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment