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
d576296c
Commit
d576296c
authored
3 years ago
by
Xiao Gui
Browse files
Options
Downloads
Patches
Plain Diff
fix tests
parent
1114cffe
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.spec.ts
+27
-6
27 additions, 6 deletions
...ehuba/nehubaViewerGlue/nehubaViewerGlue.component.spec.ts
with
27 additions
and
6 deletions
src/viewerModule/nehuba/nehubaViewerGlue/nehubaViewerGlue.component.spec.ts
+
27
−
6
View file @
d576296c
...
...
@@ -25,8 +25,7 @@ import { selectorAuxMeshes } from "../store"
import
{
TouchSideClass
}
from
"
../touchSideClass.directive
"
import
{
NehubaGlueCmp
}
from
"
./nehubaViewerGlue.component
"
import
{
HarnessLoader
}
from
"
@angular/cdk/testing
"
import
{
NehubaModule
}
from
"
../module
"
import
{
NEHUBA_VIEWER_FEATURE_KEY
}
from
"
../constants
"
import
{
AtlasWorkerService
}
from
"
src/atlasViewer/atlasViewer.workerService.service
"
@
Component
({
...
...
@@ -116,6 +115,18 @@ describe('> nehubaViewerGlue.component.ts', () => {
useValue
:
{
loadMeshes
$
:
new
Subject
()
}
},
{
provide
:
AtlasWorkerService
,
useValue
:
{
sendMessage
:
async
()
=>
{
return
{
result
:
{
meta
:
{},
buffer
:
null
}
}
}
}
}
]
}).
compileComponents
()
...
...
@@ -230,6 +241,7 @@ describe('> nehubaViewerGlue.component.ts', () => {
describe
(
'
> handleFileDrop
'
,
()
=>
{
let
addNgLayerSpy
:
jasmine
.
Spy
let
removeNgLayersSpy
:
jasmine
.
Spy
let
workerSendMessageSpy
:
jasmine
.
Spy
let
dummyFile1
:
File
let
dummyFile2
:
File
let
input
:
File
[]
...
...
@@ -258,10 +270,19 @@ describe('> nehubaViewerGlue.component.ts', () => {
removeNgLayersSpy
=
spyOn
(
fixture
.
componentInstance
[
'
layerCtrlService
'
],
'
removeNgLayers
'
).
and
.
callFake
(()
=>
{
})
workerSendMessageSpy
=
spyOn
(
fixture
.
componentInstance
[
'
worker
'
],
'
sendMessage
'
).
and
.
callFake
(
async
()
=>
{
return
{
result
:
{
meta
:
{},
buffer
:
null
}
}
})
})
afterEach
(()
=>
{
addNgLayerSpy
.
calls
.
reset
()
removeNgLayersSpy
.
calls
.
reset
()
workerSendMessageSpy
.
calls
.
reset
()
})
describe
(
'
> malformed input
'
,
()
=>
{
...
...
@@ -305,11 +326,11 @@ describe('> nehubaViewerGlue.component.ts', () => {
})
describe
(
'
> correct input
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(
async
()
=>
{
input
=
[
dummyFile1
]
const
cmp
=
fixture
.
componentInstance
cmp
.
handleFileDrop
(
input
)
await
cmp
.
handleFileDrop
(
input
)
})
afterEach
(()
=>
{
...
...
@@ -321,9 +342,9 @@ describe('> nehubaViewerGlue.component.ts', () => {
expect
(
removeNgLayersSpy
).
not
.
toHaveBeenCalled
()
expect
(
addNgLayerSpy
).
toHaveBeenCalledTimes
(
1
)
})
it
(
'
> on repeated input, both remove nglayer and remove ng layer called
'
,
()
=>
{
it
(
'
> on repeated input, both remove nglayer and remove ng layer called
'
,
async
()
=>
{
const
cmp
=
fixture
.
componentInstance
cmp
.
handleFileDrop
(
input
)
await
cmp
.
handleFileDrop
(
input
)
expect
(
removeNgLayersSpy
).
toHaveBeenCalledTimes
(
1
)
expect
(
addNgLayerSpy
).
toHaveBeenCalledTimes
(
2
)
...
...
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