Skip to content

Instantly share code, notes, and snippets.

@kuroski
Created September 7, 2018 18:58
Show Gist options
  • Save kuroski/91f45234eccdeab0a7c1614e7c9cdc20 to your computer and use it in GitHub Desktop.
Save kuroski/91f45234eccdeab0a7c1614e7c9cdc20 to your computer and use it in GitHub Desktop.
import { shallowMount } from '@vue/test-utils'
import UserView from '@/views/UserView'
import VUserSearchForm from '@/components/VUserSearchForm'
import VUserProfile from '@/components/VUserProfile'
describe('UserView', () => {
it('renders the component', () => {
// arrange
const wrapper = shallowMount(UserView)
// assert
expect(wrapper.html()).toMatchSnapshot()
})
it('renders main child components', () => {
// arrange
const wrapper = shallowMount(UserView)
const userSearchForm = wrapper.find(VUserSearchForm)
const userProfile = wrapper.find(VUserProfile)
// 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