Skip to content

Instantly share code, notes, and snippets.

@aptiko
Last active May 17, 2021 16:41
Show Gist options
  • Save aptiko/8d95b73e7c8481de40b5d410cc39d868 to your computer and use it in GitHub Desktop.
Save aptiko/8d95b73e7c8481de40b5d410cc39d868 to your computer and use it in GitHub Desktop.
Nuxt test that involves the store and does not work
import { mount } from '@vue/test-utils'
import Navbar from '@/components/Navbar.vue'
describe('Navbar', () => {
test('gets loggedOnUser from store', () => {
const wrapper = mount(Navbar)
wrapper.vm.$store.commit('setLoggedOnUser', 'alice')
expect(wrapper.vm.loggedOnUser).toBe('alice')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment