Skip to content

Instantly share code, notes, and snippets.

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

Daniel Kuroski kuroski

👨‍💻
coding
View GitHub Profile
<script>
import VUserSearchForm from '@/components/VUserSearchForm'
import VUserProfile from '@/components/VUserProfile'
export default {
name: 'UserView',
components: {
VUserSearchForm,
VUserProfile,
},
<script>
export default {
name: 'UserProfile',
props: {
user: {
type: Object,
required: true,
default: () => ({})
}
}
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}",
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)
<script>
import { mapState } from 'vuex'
import VUserSearchForm from '@/components/VUserSearchForm'
import VUserProfile from '@/components/VUserProfile'
export default {
name: 'UserView',
components: {
VUserSearchForm,
VUserProfile,
jest.mock('@/store/actions')
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 actions from '@/store/actions'
import userFixture from './fixtures/user'
import userFixture from '../../../tests/unit/fixtures/user'
export default {
SEARCH_USER: jest.fn().mockResolvedValue(userFixture)
}
<script>
import { mapState } from 'vuex'
import VUserSearchForm from '@/components/VUserSearchForm'
import VUserProfile from '@/components/VUserProfile'
export default {
name: 'UserView',
components: {
VUserSearchForm,
VUserProfile,
import { shallowMount } from '@vue/test-utils'
import VUserProfile from '@/components/VUserProfile'
import user from './fixtures/user'
describe('VUserProfile', () => {
let props
const build = () => {
const wrapper = shallowMount(VUserProfile, {
propsData: props,
<script>
export default {
name: 'UserProfile',
props: {
user: {
type: Object,
required: true,
}
}
}