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, 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) |
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
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}", |
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
<script> | |
export default { | |
name: 'UserProfile', | |
props: { | |
user: { | |
type: Object, | |
required: true, | |
default: () => ({}) | |
} | |
} |
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
<script> | |
import VUserSearchForm from '@/components/VUserSearchForm' | |
import VUserProfile from '@/components/VUserProfile' | |
export default { | |
name: 'UserView', | |
components: { | |
VUserSearchForm, | |
VUserProfile, | |
}, |
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, { | |
data: () => ({ | |
user: {} |
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 { |
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
<script> | |
import VUserSearchForm from '@/components/VUserSearchForm' | |
import VUserProfile from '@/components/VUserProfile' | |
export default { | |
name: 'UserView', | |
components: { | |
VUserSearchForm, | |
VUserProfile, | |
} |
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
<script> | |
export default { | |
name: 'UserSearchForm' | |
} | |
</script> | |
<template> | |
<div> | |
UserSearchForm | |
</div> |
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
<script> | |
export default { | |
name: 'UserProfile' | |
} | |
</script> | |
<template> | |
<div> | |
UserProfile | |
</div> |
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', () => { | |
it('renders the component', () => { | |
// arrange | |
const wrapper = shallowMount(UserView) |