Skip to content

Instantly share code, notes, and snippets.

@jamesoshea
Created July 23, 2018 06:57
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 jamesoshea/fd1be854c29ea7615eca338fe91df38c to your computer and use it in GitHub Desktop.
Save jamesoshea/fd1be854c29ea7615eca338fe91df38c to your computer and use it in GitHub Desktop.
import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex';
import CoolCard from '../components/CoolCard.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
const actions = {
incrementTotal: jest.fn()
};
describe('CoolCardNaive', () => {
let store;
beforeEach(() => {
store = new Vuex.Store({
modules: {
basket: {
namespaced: true,
actions,
getters: {
projectId: () => 4,
currentTotal: () => 789
}
}
}
});
});
test('card should show correct total', () => {
const wrapper = mount(CoolCard, { store, localVue });
expect(wrapper.vm.currentTotal).toEqual(789);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment