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
3bb56cea
Commit
3bb56cea
authored
4 years ago
by
Angelina Filippova
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for users filters
parent
3af18690
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!193
AdminAPI: change from deactivated to is_active
Pipeline
#34355
passed
4 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/views/users/usersFilters.test.js
+108
-1
108 additions, 1 deletion
test/views/users/usersFilters.test.js
with
108 additions
and
1 deletion
test/views/users/usersFilters.test.js
+
108
−
1
View file @
3bb56cea
...
...
@@ -41,7 +41,7 @@ describe('Filters users', () => {
await
flushPromises
()
})
it
(
'
enables local and active filters when component is mounted, toggles local filter on button click
'
,
(
)
=>
{
it
(
'
enables local and active filters when component is mounted, toggles local filter on button click
'
,
async
(
done
)
=>
{
const
wrapper
=
mount
(
Filters
,
{
store
,
localVue
...
...
@@ -55,5 +55,112 @@ describe('Filters users', () => {
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenCalled
()
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
2
,
expect
.
anything
(),
[
'
active
'
],
undefined
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenCalledWith
(
expect
.
anything
(),
[],
undefined
)
await
flushPromises
()
done
()
})
it
(
'
applies three filters
'
,
async
(
done
)
=>
{
const
wrapper
=
mount
(
Filters
,
{
store
,
localVue
})
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
1
,
expect
.
anything
(),
[
'
local
'
,
'
active
'
],
undefined
)
const
filter1
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
1
}
) li.el-select-dropdown__item:nth-child(
${
2
}
)`
)
filter1
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
2
,
expect
.
anything
(),
[
'
external
'
,
'
active
'
],
undefined
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenCalledWith
(
expect
.
anything
(),
[],
undefined
)
await
flushPromises
()
const
filter2
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
2
}
) li.el-select-dropdown__item:nth-child(
${
3
}
)`
)
filter2
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
3
,
expect
.
anything
(),
[
'
external
'
,
'
need_approval
'
],
undefined
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenCalledWith
(
expect
.
anything
(),
[],
undefined
)
await
flushPromises
()
const
filter3
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
3
}
) li.el-select-dropdown__item:nth-child(
${
1
}
)`
)
filter3
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
4
,
expect
.
anything
(),
[
'
external
'
,
'
need_approval
'
],
undefined
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenCalledWith
(
expect
.
anything
(),
[
'
Person
'
],
undefined
)
await
flushPromises
()
done
()
})
it
(
'
removes all filters
'
,
async
(
done
)
=>
{
const
wrapper
=
mount
(
Filters
,
{
store
,
localVue
})
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
1
,
expect
.
anything
(),
[
'
local
'
,
'
active
'
],
undefined
)
const
filter1
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
1
}
) li.el-select-dropdown__item:nth-child(
${
1
}
)`
)
filter1
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
2
,
expect
.
anything
(),
[
'
active
'
],
undefined
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenCalledWith
(
expect
.
anything
(),
[],
undefined
)
await
flushPromises
()
const
filter2
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
2
}
) li.el-select-dropdown__item:nth-child(
${
1
}
)`
)
filter2
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
3
,
expect
.
anything
(),
[],
undefined
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenCalledWith
(
expect
.
anything
(),
[],
undefined
)
await
flushPromises
()
done
()
})
it
(
'
applies actor type filters
'
,
async
(
done
)
=>
{
const
wrapper
=
mount
(
Filters
,
{
store
,
localVue
})
const
filter1
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
3
}
) li.el-select-dropdown__item:nth-child(
${
1
}
)`
)
filter1
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenNthCalledWith
(
1
,
expect
.
anything
(),
[
'
Person
'
],
undefined
)
await
flushPromises
()
const
filter2
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
3
}
) li.el-select-dropdown__item:nth-child(
${
2
}
)`
)
filter2
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenNthCalledWith
(
2
,
expect
.
anything
(),
[
'
Person
'
,
'
Service
'
],
undefined
)
await
flushPromises
()
const
filter3
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
3
}
) li.el-select-dropdown__item:nth-child(
${
3
}
)`
)
filter3
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleActorTypeFilter
).
toHaveBeenNthCalledWith
(
3
,
expect
.
anything
(),
[
'
Person
'
,
'
Service
'
,
'
Application
'
],
undefined
)
await
flushPromises
()
done
()
})
it
(
'
applies opposite filters
'
,
async
(
done
)
=>
{
const
wrapper
=
mount
(
Filters
,
{
store
,
localVue
})
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
1
,
expect
.
anything
(),
[
'
local
'
,
'
active
'
],
undefined
)
const
filter1
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
2
}
) li.el-select-dropdown__item:nth-child(
${
2
}
)`
)
filter1
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
2
,
expect
.
anything
(),
[
'
local
'
,
'
deactivated
'
],
undefined
)
await
flushPromises
()
const
filter2
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
2
}
) li.el-select-dropdown__item:nth-child(
${
3
}
)`
)
filter2
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
3
,
expect
.
anything
(),
[
'
local
'
,
'
need_approval
'
],
undefined
)
await
flushPromises
()
const
filter3
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
2
}
) li.el-select-dropdown__item:nth-child(
${
4
}
)`
)
filter3
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
4
,
expect
.
anything
(),
[
'
local
'
,
'
unconfirmed
'
],
undefined
)
await
flushPromises
()
const
filter4
=
wrapper
.
find
(
`.el-select-group__wrap:nth-child(
${
1
}
) li.el-select-dropdown__item:nth-child(
${
2
}
)`
)
filter4
.
trigger
(
'
click
'
)
expect
(
actions
.
ToggleUsersFilter
).
toHaveBeenNthCalledWith
(
5
,
expect
.
anything
(),
[
'
external
'
,
'
unconfirmed
'
],
undefined
)
await
flushPromises
()
done
()
})
})
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