Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
admin-fe
Commits
fca8d44e
Commit
fca8d44e
authored
5 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Add test for rendering user profile
parent
b278f148
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!53
Update user profile interface
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/__mocks__/users.js
+12
-0
12 additions, 0 deletions
src/api/__mocks__/users.js
test/views/users/show.test.js
+48
-0
48 additions, 0 deletions
test/views/users/show.test.js
test/views/users/store.conf.js
+2
-0
2 additions, 0 deletions
test/views/users/store.conf.js
with
62 additions
and
0 deletions
src/api/__mocks__/users.js
+
12
−
0
View file @
fca8d44e
...
...
@@ -4,6 +4,10 @@ export let users = [
{
active
:
false
,
deactivated
:
true
,
id
:
'
abc
'
,
nickname
:
'
john
'
,
local
:
true
,
external
:
false
,
roles
:
{
admin
:
false
,
moderator
:
false
},
tags
:
[
'
strip_media
'
]
}
]
const
userProfile
=
{
avatar
:
'
avatar.jpg
'
,
display_name
:
'
Allis
'
,
nickname
:
'
allis
'
,
id
:
'
2
'
,
tags
:
[],
roles
:
{
admin
:
true
,
moderator
:
false
},
local
:
true
,
external
:
false
}
const
userStatuses
=
[]
const
filterUsers
=
(
str
)
=>
{
const
filters
=
str
.
split
(
'
,
'
).
filter
(
item
=>
item
.
length
>
0
)
if
(
filters
.
length
===
0
)
{
...
...
@@ -20,6 +24,10 @@ const filterUsers = (str) => {
return
applyFilters
([],
filters
,
users
)
}
export
async
function
fetchUser
(
id
,
authHost
,
token
)
{
return
Promise
.
resolve
({
data
:
userProfile
})
}
export
async
function
fetchUsers
(
filters
,
authHost
,
token
,
page
=
1
)
{
const
filteredUsers
=
filterUsers
(
filters
)
return
Promise
.
resolve
({
data
:
{
...
...
@@ -29,6 +37,10 @@ export async function fetchUsers(filters, authHost, token, page = 1) {
}})
}
export
async
function
fetchUserStatuses
(
id
,
authHost
,
godmode
,
token
)
{
return
Promise
.
resolve
({
data
:
userStatuses
})
}
export
async
function
getPasswordResetToken
(
nickname
,
authHost
,
token
)
{
return
Promise
.
resolve
({
data
:
{
token
:
'
g05lxnBJQnL
'
,
link
:
'
http://url/api/pleroma/password_reset/g05lxnBJQnL
'
}})
}
...
...
This diff is collapsed.
Click to expand it.
test/views/users/show.test.js
0 → 100644
+
48
−
0
View file @
fca8d44e
import
Vuex
from
'
vuex
'
import
{
mount
,
createLocalVue
,
config
}
from
'
@vue/test-utils
'
import
flushPromises
from
'
flush-promises
'
import
Element
from
'
element-ui
'
import
UsersShow
from
'
@/views/users/show
'
import
storeConfig
from
'
./store.conf
'
import
{
cloneDeep
}
from
'
lodash
'
config
.
mocks
[
"
$t
"
]
=
()
=>
{}
const
localVue
=
createLocalVue
()
localVue
.
use
(
Vuex
)
localVue
.
use
(
Element
)
const
$route
=
{
params
:
{
id
:
'
2
'
}
}
jest
.
mock
(
'
@/api/nodeInfo
'
)
jest
.
mock
(
'
@/api/users
'
)
describe
(
'
Search and filter users
'
,
()
=>
{
let
store
beforeEach
(()
=>
{
store
=
new
Vuex
.
Store
(
cloneDeep
(
storeConfig
))
})
it
(
'
fetches user profile
'
,
async
(
done
)
=>
{
const
wrapper
=
mount
(
UsersShow
,
{
store
,
localVue
,
sync
:
false
,
stubs
:
[
'
router-link
'
],
mocks
:
{
$route
}
})
await
flushPromises
()
expect
(
wrapper
.
find
(
'
.user-profile-card
'
).
isVisible
()).
toBe
(
true
)
expect
(
store
.
state
.
userProfile
.
user
.
nickname
).
toBe
(
'
allis
'
)
expect
(
store
.
state
.
userProfile
.
user
.
roles
.
admin
).
toBe
(
true
)
done
()
})
})
This diff is collapsed.
Click to expand it.
test/views/users/store.conf.js
+
2
−
0
View file @
fca8d44e
import
app
from
'
@/store/modules/app
'
import
user
from
'
@/store/modules/user
'
import
userProfile
from
'
@/store/modules/userProfile
'
import
users
from
'
@/store/modules/users
'
import
getters
from
'
@/store/getters
'
...
...
@@ -7,6 +8,7 @@ export default {
modules
:
{
app
,
user
,
userProfile
,
users
},
getters
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment