Add test for updating actor_type

This commit is contained in:
Angelina Filippova 2020-08-24 00:31:38 +03:00
parent 2a42c5ed6b
commit cd92dfa695
3 changed files with 31 additions and 8 deletions

View file

@ -55,11 +55,11 @@ export async function fetchStatusesByInstance({ instance, authHost, token, pageS
'nickname': 'sky', 'nickname': 'sky',
'url': 'http://localhost:4000/users/sky' 'url': 'http://localhost:4000/users/sky'
}, },
'content': 'A nice young couple contacted us from Brazil to decorate their newly acquired apartment.', 'content': 'i love parks&rec',
'created_at': '2020-01-31T18:20:01.000Z', 'created_at': '2020-04-12T18:20:01.000Z',
'id': '9rZIr0Jzao5Gjgfmro', 'id': 'o5Gjgfmro9rZIr0Jza',
'sensitive': false, 'sensitive': false,
'url': 'http://localhost:4000/objects/7af9abbd-fb6c-4318-aeb7-6636c138ac98', 'url': 'http://localhost:4000/objects/7af9abbd-aeb7-6636c138ac98-fb6c-4318',
'visibility': 'unlisted' 'visibility': 'unlisted'
}, },
{ {

View file

@ -1,8 +1,8 @@
export let users = [ export let users = [
{ active: true, approval_pending: false, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [] }, { active: true, approval_pending: false, deactivated: false, id: '2', nickname: 'allis', local: true, external: false, roles: { admin: true, moderator: false }, tags: [], actor_type: 'Person' },
{ active: true, approval_pending: false, deactivated: false, id: '10', nickname: 'bob', local: false, external: true, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'] }, { active: true, approval_pending: false, deactivated: false, id: '10', nickname: 'bob', local: false, external: true, roles: { admin: false, moderator: false }, tags: ['mrf_tag:sandbox'], actor_type: 'Person' },
{ active: false, approval_pending: false, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'] }, { active: false, approval_pending: false, deactivated: true, id: 'abc', nickname: 'john', local: true, external: false, roles: { admin: false, moderator: false }, tags: ['mrf_tag:media-strip'], actor_type: 'Person' },
{ active: true, approval_pending: true, deactivated: false, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [] } { active: true, approval_pending: true, deactivated: false, id: '100', nickname: 'sally', local: true, external: false, roles: { admin: false, moderator: false }, tags: [], actor_type: 'Service' }
] ]
const userProfile = { avatar: 'avatar.jpg', nickname: 'allis', id: '2', tags: [], roles: { admin: true, moderator: false }, local: true, external: false } const userProfile = { avatar: 'avatar.jpg', nickname: 'allis', id: '2', tags: [], roles: { admin: true, moderator: false }, local: true, external: false }
@ -119,3 +119,7 @@ export async function createNewAccount(nickname, email, password, authHost, toke
users = [...users, newUser] users = [...users, newUser]
return Promise.resolve() return Promise.resolve()
} }
export async function updateUserCredentials(nickname, credentials, authHost, token) {
return Promise.resolve()
}

View file

@ -353,7 +353,26 @@ describe('Creates new account', () => {
expect(wrapper.vm.validatePassword(validatePasswordRule, '', identity)).toBeInstanceOf(Error) expect(wrapper.vm.validatePassword(validatePasswordRule, '', identity)).toBeInstanceOf(Error)
expect(wrapper.vm.validatePassword(validatePasswordRule, '1234', identity)).toBeUndefined() expect(wrapper.vm.validatePassword(validatePasswordRule, '1234', identity)).toBeUndefined()
})
it('updates actor type', async (done) => {
const wrapper = mount(Users, {
store,
localVue,
sync: false,
stubs: ['router-link']
})
await flushPromises()
const user = store.state.users.fetchedUsers[0]
expect(user.actor_type).toBe('Person')
const findWrapper = (trChild, liChild1, liChild2) =>
`.el-table__fixed-body-wrapper table tr:nth-child(${trChild}) ul.el-dropdown-menu > li:nth-child(${liChild1}) ul li:nth-child(${liChild2})`
wrapper.find(findWrapper(1, 1, 1)).trigger('click')
const updatedUser = store.state.users.fetchedUsers[0]
expect(updatedUser.actor_type).toBe('Service')
done()
}) })
}) })