Created
May 17, 2021 16:45
-
-
Save aptiko/41d6a2186b3854f8f2afe511018d041c to your computer and use it in GitHub Desktop.
Testing store-related Nuxt functionality with mocking
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 } from '@vue/test-utils' | |
import Navbar from '@/components/Navbar.vue' | |
describe('Navbar', () => { | |
test('gets loggedOnUser from store', () => { | |
const wrapper = mount(Navbar, { | |
mocks: { | |
$store: { state: { loggedOnUser: '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