Last active
August 20, 2019 10:15
-
-
Save matthewblewitt/5098b93caea8c2a5b5771c34cc4b7051 to your computer and use it in GitHub Desktop.
Vue util cheat sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { mount, createLocalVue } from "vue-test-utils"; | |
import { actions, mutations } from "~/test/mocks/store-actions-mutations.mock"; | |
import Component from "~/pages/index.vue"; | |
import Vuex from "vuex"; | |
const localVue = createLocalVue(); | |
localVue.use(Vuex); | |
const store = new Vuex.Store({ state, mutations, actions }); | |
const cmp = mount(Component, { | |
store, | |
localVue, | |
stubs: { | |
ChildComponent: "<div></div>" | |
}, | |
mocks: { | |
$router: { | |
push: jest.fn() | |
} | |
} | |
}); | |
cmp.setData({pageSize: count}) | |
describe("watch", () => { | |
it("pageIsValid should fire set progress navigation", next => { | |
cmp.setComputed({ | |
pageIsValid: true | |
}); | |
cmp.vm.$nextTick(() => { | |
expect(mutations.SET_PROGRESS_NAVIGATION.mock.calls[0][1]).toEqual({ | |
valid: true | |
}); | |
next(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment