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
Merge requests
!10
Feat/rechercher point
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feat/rechercher point
feat/rechercher-point
into
main
Overview
0
Commits
21
Pipelines
13
Changes
12
Merged
Bastien DUMONT
requested to merge
feat/rechercher-point
into
main
2 years ago
Overview
0
Commits
21
Pipelines
13
Changes
12
Expand
0
0
Merge request reports
Compare
main
version 12
13695c66
2 years ago
version 11
03dfdd8c
2 years ago
version 10
3a1b137a
2 years ago
version 9
4371435d
2 years ago
version 8
733d76fa
2 years ago
version 7
dfff97e4
2 years ago
version 6
27938c05
2 years ago
version 5
18e3d959
2 years ago
version 4
bdeb7441
2 years ago
version 3
0840e453
2 years ago
version 2
356c7362
2 years ago
version 1
1198ee7b
2 years ago
main (base)
and
latest version
latest version
257a36a3
21 commits,
2 years ago
version 12
13695c66
20 commits,
2 years ago
version 11
03dfdd8c
19 commits,
2 years ago
version 10
3a1b137a
18 commits,
2 years ago
version 9
4371435d
17 commits,
2 years ago
version 8
733d76fa
16 commits,
2 years ago
version 7
dfff97e4
15 commits,
2 years ago
version 6
27938c05
13 commits,
2 years ago
version 5
18e3d959
10 commits,
2 years ago
version 4
bdeb7441
9 commits,
2 years ago
version 3
0840e453
8 commits,
2 years ago
version 2
356c7362
7 commits,
2 years ago
version 1
1198ee7b
6 commits,
2 years ago
12 files
+
345
−
94
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
12
Search (e.g. *.vue) (Ctrl+P)
__tests__/requests/bo.spec.js
0 → 100644
+
93
−
0
Options
const
{
createBoConsent
,
getBoConsent
}
=
require
(
'
../../src/requests/bo
'
)
const
{
default
:
axios
}
=
require
(
'
axios
'
)
const
{
errors
}
=
require
(
'
cozy-konnector-libs
'
)
jest
.
mock
(
'
axios
'
)
describe
(
'
Backoffice routes
'
,
()
=>
{
describe
(
'
createBoConsent
'
,
()
=>
{
it
(
'
should send consent to BO
'
,
async
()
=>
{
axios
.
post
.
mockResolvedValueOnce
({
id
:
1
})
const
consent
=
await
createBoConsent
({
pdl
:
11111111111111
,
name
:
'
POUET
'
,
adresse
:
'
20 rue du lac
'
,
postalCode
:
'
69003
'
,
inseeCode
:
'
69383
'
,
})
expect
(
consent
).
toBe
({
id
:
1
})
})
it
(
'
should handle unavailable BO
'
,
async
()
=>
{
axios
.
post
.
mockImplementationOnce
(()
=>
Promise
.
reject
(
errors
.
MAINTENANCE
)
)
try
{
await
createBoConsent
({
pdl
:
11111111111111
,
name
:
'
POUET
'
,
adresse
:
'
20 rue du lac
'
,
postalCode
:
'
69003
'
,
inseeCode
:
'
69383
'
,
})
expect
(
true
).
toBe
(
false
)
}
catch
(
e
)
{
expect
(
e
).
toBe
(
errors
.
MAINTENANCE
)
}
})
})
describe
(
'
getBoConsent
'
,
()
=>
{
it
(
'
should get consent from BO
'
,
async
()
=>
{
axios
.
get
.
mockResolvedValueOnce
({
id
:
1
,
pointId
:
11111111111111
,
name
:
'
POUET
'
,
adresse
:
'
20 rue du lac
'
,
postalCode
:
'
69003
'
,
inseeCode
:
'
69383
'
,
})
const
consent
=
await
getBoConsent
(
1
)
expect
(
consent
).
toBe
({
pointId
:
11111111111111
,
name
:
'
POUET
'
,
adresse
:
'
20 rue du lac
'
,
postalCode
:
'
69003
'
,
inseeCode
:
'
69383
'
,
})
})
it
(
'
should get consent from BO with service id
'
,
async
()
=>
{
axios
.
get
.
mockResolvedValueOnce
({
id
:
1
,
pointId
:
11111111111111
,
name
:
'
POUET
'
,
adresse
:
'
20 rue du lac
'
,
postalCode
:
'
69003
'
,
inseeCode
:
'
69383
'
,
serviceId
:
'
abcde
'
,
})
const
consent
=
await
getBoConsent
(
1
)
expect
(
consent
.
serviceId
).
toBeTruthy
()
expect
(
consent
).
toBe
({
pointId
:
11111111111111
,
name
:
'
POUET
'
,
adresse
:
'
20 rue du lac
'
,
postalCode
:
'
69003
'
,
inseeCode
:
'
69383
'
,
serviceId
:
'
abcde
'
,
})
})
it
(
'
should handle unavailable BO
'
,
async
()
=>
{
axios
.
get
.
mockImplementationOnce
(()
=>
Promise
.
reject
(
errors
.
MAINTENANCE
))
try
{
await
createBoConsent
({
pointId
:
11111111111111
,
name
:
'
POUET
'
,
adresse
:
'
20 rue du lac
'
,
postalCode
:
'
69003
'
,
inseeCode
:
'
69383
'
,
})
expect
(
true
).
toBe
(
false
)
}
catch
(
e
)
{
expect
(
e
).
toBe
(
errors
.
MAINTENANCE
)
}
})
})
})
Loading