Created
September 7, 2018 19:18
-
-
Save kuroski/9384336e96f38b1cf6cf3465d1163c6a 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 { shallowMount } from '@vue/test-utils' | |
import UserView from '@/views/UserView' | |
import VUserSearchForm from '@/components/VUserSearchForm' | |
import VUserProfile from '@/components/VUserProfile' | |
describe('UserView', () => { | |
const build = () => { | |
const wrapper = shallowMount(UserView) | |
return { | |
wrapper, | |
userSearchForm: () => wrapper.find(VUserSearchForm), | |
userProfile: () => wrapper.find(VUserProfile) | |
} | |
} | |
it('renders the component', () => { | |
// arrange | |
const { wrapper } = build() | |
// assert | |
expect(wrapper.html()).toMatchSnapshot() | |
}) | |
it('renders main child components', () => { | |
// arrange | |
const { userSearchForm, userProfile } = build() | |
// assert | |
expect(userSearchForm().exists()).toBe(true) | |
expect(userProfile().exists()).toBe(true) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment