Skip to content

Instantly share code, notes, and snippets.

@dvallin
Created November 29, 2017 16:46
Show Gist options
  • Save dvallin/d76d0da36c8d6dbd8b51dc9f97e3c5fe to your computer and use it in GitHub Desktop.
Save dvallin/d76d0da36c8d6dbd8b51dc9f97e3c5fe to your computer and use it in GitHub Desktop.
import {Actions} from "../../src/store";
//...
describe('add task', () => {
it('dispatches AddTask action to store', () => {
const context = { $store: { dispatch: jest.fn() }, taskTitle: "title" };
NewTaskInput.methods.addTask.bind(context)();
expect(context.$store.dispatch).toHaveBeenCalledWith({
type: Actions.AddTask,
title: "title"
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment