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 userFixture from '../../tests/unit/fixtures/user' | |
export default { | |
searchUser: jest.fn().mockResolvedValue(userFixture) | |
} |
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
jest.mock('@/api') | |
import flushPromises from 'flush-promises' | |
import actions from '@/store/actions' | |
import api from '@/api' | |
import userFixture from './fixtures/user' | |
describe('store actions', () => { | |
let commit | |
beforeEach(() => { |
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', | |
data() { | |
return { | |
username: '' | |
} | |
} | |
} | |
</script> |
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 VUserSearchForm from '@/components/VUserSearchForm' | |
describe('VUserSearchForm', () => { | |
const build = () => { | |
const wrapper = shallowMount(VUserSearchForm) | |
return { | |
wrapper, | |
input: () => wrapper.find('input'), |
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, | |
} | |
} | |
} |
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 VUserProfile from '@/components/VUserProfile' | |
import user from './fixtures/user' | |
describe('VUserProfile', () => { | |
let props | |
const build = () => { | |
const wrapper = shallowMount(VUserProfile, { | |
propsData: props, |
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 { mapState } from 'vuex' | |
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 userFixture from '../../../tests/unit/fixtures/user' | |
export default { | |
SEARCH_USER: jest.fn().mockResolvedValue(userFixture) | |
} |
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
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' |
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 { mapState } from 'vuex' | |
import VUserSearchForm from '@/components/VUserSearchForm' | |
import VUserProfile from '@/components/VUserProfile' | |
export default { | |
name: 'UserView', | |
components: { | |
VUserSearchForm, | |
VUserProfile, |