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
6bb2458e
Commit
6bb2458e
authored
2 years ago
by
Titus Netland
Browse files
Options
Downloads
Patches
Plain Diff
Updated mock test
parent
f989e76d
No related branches found
Branches containing commit
No related tags found
Loading
Pipeline
#175608
failed
2 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unit/apiutil-login-mock.spec.js
+3
-2
3 additions, 2 deletions
tests/unit/apiutil-login-mock.spec.js
with
3 additions
and
2 deletions
tests/unit/apiutil-login-mock.spec.js
+
3
−
2
View file @
6bb2458e
...
...
@@ -7,8 +7,9 @@ describe("testing mocking of apiutil.js", () => {
it
(
"
check that login fails with wrong credentials - against mock
"
,
async
()
=>
{
// mock api response on POST call (once)
const
expectedLoginResponse
=
"
Login failed
"
;
axios
.
post
.
mockImplementation
(()
=>
Promise
.
resolve
(
expectedLoginResponse
)
Promise
.
resolve
(
{
data
:
"
Login failed
"
}
)
);
// do the call
...
...
@@ -29,7 +30,7 @@ describe("testing mocking of apiutil.js", () => {
"
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
"
,
};
const
expectedLoginResponse
=
"
Login failed
"
;
axios
.
post
.
mockImplementation
(()
=>
Promise
.
resolve
(
apiResponse
));
axios
.
post
.
mockImplementation
(()
=>
Promise
.
resolve
(
{
data
:
apiResponse
}
));
// do the call
const
loginRequest
=
{
...
...
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