Skip to content

Instantly share code, notes, and snippets.

@jamesoshea
Last active July 23, 2018 06:40
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/4daf46f45ac91c0e6c3540d8fa25b755 to your computer and use it in GitHub Desktop.
Save jamesoshea/4daf46f45ac91c0e6c3540d8fa25b755 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';
import StoreFactory from './utils/StoreFactory';
const localVue = createLocalVue();
localVue.use(Vuex);
const actions = {
incrementTotal: jest.fn()
};
describe('CoolCard', () => {
let store;
beforeEach(() => {
store = StoreFactory(
{
basket: { currentTotal: 567 }
},
actions
);
});
test('card should show correct total', () => {
const wrapper = mount(CoolCard, { store, localVue });
expect(wrapper.vm.currentTotal).toEqual(567);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment