import { mount, createLocalVue } from '@vue/test-utils' import Vuex from 'vuex' import UserProfile from 'src/components/user_profile/user_profile.vue' import backendInteractorService from 'src/services/backend_interactor_service/backend_interactor_service.js' const localVue = createLocalVue() localVue.use(Vuex) const mutations = { clearTimeline: () => {} } const store = new Vuex.Store({ mutations, state: { api: { backendInteractor: backendInteractorService('') }, config: { colors: '', highlight: {} }, instance: { hideUserStats: true }, statuses: { timelines: { user: { statuses: [], statusesObject: {}, faves: [], visibleStatuses: [], visibleStatusesObject: {}, newStatusCount: 0, maxId: 0, minVisibleId: 0, loading: false, followers: [], friends: [], viewing: 'statuses', userId: 701, flushMarker: 0 } } }, users: { currentUser: { credentials: '' }, usersObject: [ { background_image: null, cover_photo: 'https://playvicious.social/system/accounts/headers/000/000/001/original/7dae4fc0e8330e83.jpg?1507329206', created_at: 'Mon Dec 18 16:01:35 +0000 2017', default_scope: 'public', description: "Your favorite person's favorite person.", description_html: "

Your favorite person's favorite person.

", favourites_count: 0, fields: [ { name: '✌🏾', value: 'thetwelfth.house' }, { name: '🚧', value: 'code.playvicio.us' }, { name: '❤️', value: 'patreon.com/Are0h' } ], followers_count: 2, following: false, follows_you: false, friends_count: 0, id: 701, is_local: false, locked: false, name: 'Are0h', name_html: 'Are0h', no_rich_text: false, profile_image_url: 'https://playvicious.social/system/accounts/avatars/000/000/001/original/33e9983bc2d96aeb.png?1520872572', profile_image_url_https: 'https://playvicious.social/system/accounts/avatars/000/000/001/original/33e9983bc2d96aeb.png?1520872572', profile_image_url_original: 'https://playvicious.social/system/accounts/avatars/000/000/001/original/33e9983bc2d96aeb.png?1520872572', profile_image_url_profile_size: 'https://playvicious.social/system/accounts/avatars/000/000/001/original/33e9983bc2d96aeb.png?1520872572', rights: { delete_others_notice: false }, screen_name: 'Are0h@playvicious.social', statuses_count: 6727, statusnet_blocking: false, statusnet_profile_url: 'https://playvicious.social/users/Are0h' } ] } } }) describe('UserProfile', () => { it('renders', () => { const wrapper = mount(UserProfile, { localVue, store, mocks: { $route: { params: { id: 701 }, name: 'external-user-profile' }, $t: (msg) => msg } }) expect(wrapper.find('.user-screen-name').text()).to.eql('@Are0h@playvicious.social') }) })