Skip to content

Instantly share code, notes, and snippets.

View kuroski's full-sized avatar
👨‍💻
coding

Daniel Kuroski kuroski

👨‍💻
coding
View GitHub Profile
import { shallowMount, createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'
import UserView from '@/views/UserView'
import VUserSearchForm from '@/components/VUserSearchForm'
import VUserProfile from '@/components/VUserProfile'
import initialState from '@/store/state'
import userFixture from './fixtures/user'
const localVue = createLocalVue()
localVue.use(Vuex)
export default {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
<script>
export default {
name: 'UserProfile',
props: {
user: {
type: Object,
required: true,
default: () => ({})
}
}
<script>
import VUserSearchForm from '@/components/VUserSearchForm'
import VUserProfile from '@/components/VUserProfile'
export default {
name: 'UserView',
components: {
VUserSearchForm,
VUserProfile,
},
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, {
data: () => ({
user: {}
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 {
<script>
import VUserSearchForm from '@/components/VUserSearchForm'
import VUserProfile from '@/components/VUserProfile'
export default {
name: 'UserView',
components: {
VUserSearchForm,
VUserProfile,
}
<script>
export default {
name: 'UserSearchForm'
}
</script>
<template>
<div>
UserSearchForm
</div>
<script>
export default {
name: 'UserProfile'
}
</script>
<template>
<div>
UserProfile
</div>
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)