Created
July 23, 2018 06:57
-
-
Save jamesoshea/fd1be854c29ea7615eca338fe91df38c to your computer and use it in GitHub Desktop.
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 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