Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
enedis_sge_konnector
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
enedis_sge_konnector
Commits
479e84a3
Commit
479e84a3
authored
1 year ago
by
Rémi PAILHAREY
Browse files
Options
Downloads
Patches
Plain Diff
fix: tests
parent
47fb5f4e
No related branches found
No related tags found
1 merge request
!49
Resolve "[2] [CONSENT_ID] Évolution du consent_id vers une id métier"
Pipeline
#77794
passed
1 year ago
Stage: test
Stage: build
Stage: update-instances
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
__tests__/requests/bo.spec.js
+20
-11
20 additions, 11 deletions
__tests__/requests/bo.spec.js
src/requests/bo.js
+3
-3
3 additions, 3 deletions
src/requests/bo.js
with
23 additions
and
14 deletions
__tests__/requests/bo.spec.js
+
20
−
11
View file @
479e84a3
...
...
@@ -45,7 +45,7 @@ describe('Backoffice routes', () => {
})
})
it
(
'
should handle unavailable BO
'
,
async
()
=>
{
axios
.
post
.
mock
ImplementationOnce
(()
=>
Promise
.
reject
(
'
fail
'
))
axios
.
post
.
mock
RejectedValueOnce
(
new
Error
(
'
request
fail
ed
'
))
try
{
await
createBoConsent
(
'
http://test.com
'
,
...
...
@@ -105,7 +105,7 @@ describe('Backoffice routes', () => {
})
})
it
(
'
should handle unavailable BO
'
,
async
()
=>
{
axios
.
put
.
mock
ImplementationOnce
(()
=>
Promise
.
reject
(
'
fail
'
))
axios
.
put
.
mock
RejectedValueOnce
(
new
Error
(
'
request
fail
ed
'
))
try
{
await
updateBoConsent
(
'
http://test.com
'
,
...
...
@@ -157,7 +157,7 @@ describe('Backoffice routes', () => {
})
})
it
(
'
should handle unavailable BO
'
,
async
()
=>
{
axios
.
put
.
mock
ImplementationOnce
(()
=>
Promise
.
reject
(
'
fail
'
))
axios
.
put
.
mock
RejectedValueOnce
(
new
Error
(
'
request
fail
ed
'
))
try
{
await
deleteBoConsent
(
'
http://test.com
'
,
'
token
'
,
1
)
expect
(
true
).
toBe
(
false
)
...
...
@@ -192,19 +192,28 @@ describe('Backoffice routes', () => {
})
it
(
'
should handle unavailable BO
'
,
async
()
=>
{
axios
.
get
.
mock
ImplementationOnce
(()
=>
Promise
.
reject
(
errors
.
MAINTENANCE
))
axios
.
get
.
mock
RejectedValueOnce
(
new
Error
(
'
request failed
'
))
try
{
await
getBoConsent
({
pointId
:
11111111111111
,
name
:
'
POUET
'
,
adresse
:
'
20 rue du lac
'
,
postalCode
:
'
69003
'
,
inseeCode
:
'
69383
'
,
})
await
getBoConsent
(
'
http://test.com
'
,
'
token
'
,
'
1
'
)
expect
(
true
).
toBe
(
false
)
}
catch
(
error
)
{
expect
(
error
.
message
).
toBe
(
errors
.
MAINTENANCE
)
}
})
it
(
'
should handle not found consent
'
,
async
()
=>
{
axios
.
get
.
mockRejectedValueOnce
({
response
:
{
status
:
404
,
data
:
{
code
:
404
,
description
:
'
Not Found
'
},
},
})
try
{
await
getBoConsent
(
'
http://test.com
'
,
'
token
'
,
'
n0tF0unD
'
)
expect
(
true
).
toBe
(
false
)
}
catch
(
error
)
{
expect
(
error
.
message
).
toBe
(
errors
.
LOGIN_FAILED
)
}
})
})
})
This diff is collapsed.
Click to expand it.
src/requests/bo.js
+
3
−
3
View file @
479e84a3
...
...
@@ -134,10 +134,10 @@ async function getBoConsent(url, token, consentId) {
consentId
:
consentId
,
},
})
if
(
err
.
response
.
status
===
404
)
{
throw
errors
.
LOGIN_FAILED
if
(
err
.
response
?
.
status
===
404
)
{
throw
new
Error
(
errors
.
LOGIN_FAILED
)
}
throw
errors
.
MAINTENANCE
throw
new
Error
(
errors
.
MAINTENANCE
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Ghost User
@ghost
mentioned in commit
d51b7588
·
1 year ago
mentioned in commit
d51b7588
mentioned in commit d51b7588528cc5c8ab9caa8d485868e44fd3885b
Toggle commit list
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