Skip to content

Commit

Permalink
#68 - changed action to mutation i App.test.js file
Browse files Browse the repository at this point in the history
  • Loading branch information
szafran89 committed Dec 21, 2018
1 parent 175fb8f commit a1f3e46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 6 additions & 5 deletions test/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ localVue.use(Vuex)

describe('App.test.js', () => {
let store
let actions
let mutations
let wrapper

beforeEach(() => {
actions = {
getCustomerData: jest.fn()
mutations = {
setItem: jest.fn()
}
store = new Vuex.Store({
actions
mutations
})

wrapper = shallowMount(App, {
computed: {
isCustomerLoggedIn: () => true
isCustomerLoggedIn: () => true,
customerData: () => null
},
store,
localVue
Expand Down
5 changes: 4 additions & 1 deletion view/frontend/web/js/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ export default {
computed: {
isCustomerLoggedIn () {
return this.$store.getters.isCustomerLoggedIn
},
customerData () {
return window.config.customerData
}
},
mounted () {
if (this.isCustomerLoggedIn) {
this.$store.commit('setItem', {
item: 'customer',
value: window.config.customerData
value: this.customerData
})
}
}
Expand Down

0 comments on commit a1f3e46

Please sign in to comment.