Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boco-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
idatt2106_2022_02
boco-frontend
Commits
19b97f68
Commit
19b97f68
authored
2 years ago
by
Zara Mudassar
Browse files
Options
Downloads
Patches
Plain Diff
Mock test for getting members of a community
parent
c1250d85
No related branches found
Branches containing commit
No related tags found
1 merge request
!64
Community hamburgermeny
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unit/apiutil-memberlist.spec.js
+37
-0
37 additions, 0 deletions
tests/unit/apiutil-memberlist.spec.js
with
37 additions
and
0 deletions
tests/unit/apiutil-memberlist.spec.js
0 → 100644
+
37
−
0
View file @
19b97f68
import
{
GetMembersOfCommunity
}
from
"
@/utils/apiutil
"
;
import
axios
from
"
axios
"
;
jest
.
mock
(
"
axios
"
);
describe
(
"
testing mocking of apiutil.js
"
,
()
=>
{
it
(
"
check that existing group returns correct members
"
,
async
()
=>
{
const
expectedResponse
=
{
member1
:
{
userId
:
2
,
email
:
"
erik@erik.com
"
,
firstName
:
"
erik
"
,
lastName
:
"
hansen
"
,
address
:
"
gløshaugen
"
,
picture
:
"
ok
"
},
member2
:
{
userId
:
1
,
email
:
"
test@test.com
"
,
firstName
:
"
test
"
,
lastName
:
"
testesen
"
,
address
:
"
oslo
"
,
picture
:
"
ok
"
},
};
axios
.
get
.
mockImplementation
(()
=>
Promise
.
resolve
({
data
:
expectedResponse
})
);
const
communityMembersResponse
=
await
GetMembersOfCommunity
(
4040
);
expect
(
communityMembersResponse
).
toBe
(
expectedResponse
);
})
});
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