forked from AkkomaGang/akkoma-fe
Add local profile test
This commit is contained in:
parent
828b1c78f9
commit
b524e73a65
2 changed files with 107 additions and 5 deletions
|
@ -24,7 +24,6 @@ describe('routes', () => {
|
||||||
|
|
||||||
const matchedComponents = router.getMatchedComponents()
|
const matchedComponents = router.getMatchedComponents()
|
||||||
|
|
||||||
console.log(matchedComponents[0].components.UserCardContent)
|
expect(matchedComponents[0].components.hasOwnProperty('UserCardContent')).to.eql(true)
|
||||||
expect(matchedComponents[0].components.hasOwnProperty('UserProfile')).to.eql(true)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -10,7 +10,7 @@ const mutations = {
|
||||||
clearTimeline: () => {}
|
clearTimeline: () => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
const externalProfileStore = new Vuex.Store({
|
||||||
mutations,
|
mutations,
|
||||||
state: {
|
state: {
|
||||||
api: {
|
api: {
|
||||||
|
@ -97,11 +97,98 @@ const store = new Vuex.Store({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const localProfileStore = 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: "<p>Your favorite person's favorite person.</p>",
|
||||||
|
favourites_count: 0,
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
name: '✌🏾',
|
||||||
|
value: '<a href="https://thetwelfth.house" rel="me nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="">thetwelfth.house</span><span class="invisible"></span></a>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '🚧',
|
||||||
|
value: '<a href="https://code.playvicio.us" rel="me nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="">code.playvicio.us</span><span class="invisible"></span></a>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '❤️',
|
||||||
|
value: '<a href="https://www.patreon.com/Are0h" rel="me nofollow noopener" target="_blank"><span class="invisible">https://www.</span><span class="">patreon.com/Are0h</span><span class="invisible"></span></a>'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
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',
|
||||||
|
statuses_count: 6727,
|
||||||
|
statusnet_blocking: false,
|
||||||
|
statusnet_profile_url: 'https://playvicious.social/users/Are0h'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
describe('UserProfile', () => {
|
describe('UserProfile', () => {
|
||||||
it('renders', () => {
|
it('renders external profile', () => {
|
||||||
const wrapper = mount(UserProfile, {
|
const wrapper = mount(UserProfile, {
|
||||||
localVue,
|
localVue,
|
||||||
store,
|
store: externalProfileStore,
|
||||||
mocks: {
|
mocks: {
|
||||||
$route: {
|
$route: {
|
||||||
params: { id: 701 },
|
params: { id: 701 },
|
||||||
|
@ -113,4 +200,20 @@ describe('UserProfile', () => {
|
||||||
|
|
||||||
expect(wrapper.find('.user-screen-name').text()).to.eql('@Are0h@playvicious.social')
|
expect(wrapper.find('.user-screen-name').text()).to.eql('@Are0h@playvicious.social')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('renders local profile', () => {
|
||||||
|
const wrapper = mount(UserProfile, {
|
||||||
|
localVue,
|
||||||
|
store: localProfileStore,
|
||||||
|
mocks: {
|
||||||
|
$route: {
|
||||||
|
params: { name: 'Are0h' },
|
||||||
|
name: 'user-profile'
|
||||||
|
},
|
||||||
|
$t: (msg) => msg
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(wrapper.find('.user-screen-name').text()).to.eql('@Are0h')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue