Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
siibra-explorer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiao Gui
siibra-explorer
Commits
332b0c65
Commit
332b0c65
authored
3 years ago
by
Xiao Gui
Browse files
Options
Downloads
Patches
Plain Diff
fix: backend tests
parent
ead0adda
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
deploy/app.spec.js
+0
-8
0 additions, 8 deletions
deploy/app.spec.js
deploy/auth/index.spec.js
+4
-20
4 additions, 20 deletions
deploy/auth/index.spec.js
with
4 additions
and
28 deletions
deploy/app.spec.js
+
0
−
8
View file @
332b0c65
...
...
@@ -25,13 +25,6 @@ describe('authentication', () => {
const
authConfigureAuthStub
=
sinon
.
stub
(
auth
,
'
configureAuth
'
)
const
authIsReadyStub
=
sinon
.
stub
(
auth
,
'
ready
'
)
require
.
cache
[
require
.
resolve
(
'
./datasets
'
)]
=
{
exports
:
{
router
:
(
req
,
res
,
next
)
=>
next
(),
ready
:
async
()
=>
true
}
}
require
.
cache
[
require
.
resolve
(
'
./saneUrl
'
)]
=
{
exports
:
{
router
:
(
req
,
res
,
next
)
=>
next
(),
...
...
@@ -61,7 +54,6 @@ describe('authentication', () => {
})
after
(()
=>
{
delete
require
.
cache
[
require
.
resolve
(
'
./datasets
'
)]
delete
require
.
cache
[
require
.
resolve
(
'
./saneUrl
'
)]
delete
require
.
cache
[
require
.
resolve
(
'
./user
'
)]
delete
require
.
cache
[
require
.
resolve
(
'
./constants
'
)]
...
...
This diff is collapsed.
Click to expand it.
deploy/auth/index.spec.js
+
4
−
20
View file @
332b0c65
const
sinon
=
require
(
'
sinon
'
)
const
{
assert
,
expect
}
=
require
(
'
chai
'
)
const
initPassportJsStub
=
sinon
.
stub
()
const
hbpOidcStub
=
sinon
.
stub
()
const
hbpOidcV2Stub
=
sinon
.
stub
()
const
appGetStub
=
sinon
.
stub
()
...
...
@@ -12,9 +10,6 @@ describe('auth/index.js', () => {
require
.
cache
[
require
.
resolve
(
'
./util
'
)]
=
{
exports
:
{
initPassportJs
:
initPassportJsStub
}
}
require
.
cache
[
require
.
resolve
(
'
./hbp-oidc
'
)]
=
{
exports
:
hbpOidcStub
}
require
.
cache
[
require
.
resolve
(
'
./hbp-oidc-v2
'
)]
=
{
exports
:
{
bootstrapApp
:
hbpOidcV2Stub
...
...
@@ -24,9 +19,7 @@ describe('auth/index.js', () => {
beforeEach
(()
=>
{
delete
require
.
cache
[
require
.
resolve
(
'
./index.js
'
)]
hbpOidcStub
.
returns
({})
hbpOidcV2Stub
.
returns
({})
hbpOidcStub
.
resetHistory
()
hbpOidcV2Stub
.
resetHistory
()
})
...
...
@@ -37,11 +30,6 @@ describe('auth/index.js', () => {
const
dummyObj
=
{
get
:
appGetStub
}
await
configureAuth
(
dummyObj
)
assert
(
hbpOidcStub
.
called
,
'
hbpOidc called
'
)
assert
(
hbpOidcV2Stub
.
called
,
'
hbpOidcV2 called
'
...
...
@@ -58,7 +46,7 @@ describe('auth/index.js', () => {
const
{
configureAuth
}
=
require
(
'
./index.js
'
)
const
dummyObj
=
{
get
:
appGetStub
}
hbpOidcStub
.
throws
(
`throw error`
)
hbpOidc
V2
Stub
.
throws
(
`throw error`
)
try
{
...
...
@@ -76,14 +64,10 @@ describe('auth/index.js', () => {
}
catch
(
e
)
{
assert
(
hbpOidcStub
.
calledThrice
,
'
hbpOidc called thrice
'
hbpOidc
V2
Stub
.
calledThrice
,
'
hbpOidc
v2
called thrice
'
)
assert
(
!
hbpOidcV2Stub
.
called
,
'
hbpOidcV2 not called
'
)
}
})
})
...
...
@@ -105,7 +89,7 @@ describe('auth/index.js', () => {
const
{
configureAuth
,
ready
}
=
require
(
'
./index.js
'
)
const
dummyObj
=
{
get
:
appGetStub
}
hbpOidcStub
.
throws
(
`throw error`
)
hbpOidc
V2
Stub
.
throws
(
`throw error`
)
try
{
await
(()
=>
new
Promise
((
rs
,
rj
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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