Skip to content

Instantly share code, notes, and snippets.

@sonicoder86
Created July 22, 2020 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonicoder86/97179c47a33ab9f7bbd28a241d8df81a to your computer and use it in GitHub Desktop.
Save sonicoder86/97179c47a33ab9f7bbd28a241d8df81a to your computer and use it in GitHub Desktop.
Svelte 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'
}));
const { store, onModify } = createStore();
let info;
store.subscribe(value => info = value);
await onModify('Modified by click');
expect(info).toEqual('Modified by post');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment