Skip to content

Instantly share code, notes, and snippets.

@bmfteixeira
Last active September 16, 2017 13:57
Show Gist options
  • Save bmfteixeira/f97e85f9271c6d4dc84fb5171febd529 to your computer and use it in GitHub Desktop.
Save bmfteixeira/f97e85f9271c6d4dc84fb5171febd529 to your computer and use it in GitHub Desktop.
Simple Vue action test
// the action
[actionTypes.ACTION_SET_FAV_ELEM] (context, elemId) {
context.commit(mutationTypes.MUTATION_SET_FAV_ELEM, elemId)
}
// the test
it('should invoke mutation to set the favourite element', done => {
const elemId = 'AAAAAA'
testAction(actions[actionTypes.ACTION_SET_FAV_ELEM], elemId, {}, [
{ type: mutationTypes.MUTATION_SET_FAV_ELEM, payload: elemId }
], () => {
done()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment