Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
anis-client
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
anis
anis-client
Commits
e615e272
Commit
e615e272
authored
4 years ago
by
Tifenn Guillas
Browse files
Options
Downloads
Patches
Plain Diff
Tests on detail containers => DONE
parent
eac2a216
No related branches found
No related tags found
2 merge requests
!147
Develop
,
!135
Resolve "Continue tests integration"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/detail/containers/detail.component.html
+5
-5
5 additions, 5 deletions
src/app/detail/containers/detail.component.html
src/app/detail/containers/detail.component.spec.ts
+84
-0
84 additions, 0 deletions
src/app/detail/containers/detail.component.spec.ts
with
89 additions
and
5 deletions
src/app/detail/containers/detail.component.html
+
5
−
5
View file @
e615e272
...
@@ -12,11 +12,11 @@
...
@@ -12,11 +12,11 @@
</div>
</div>
<div
*ngIf=
"objectIsLoaded | async"
>
<div
*ngIf=
"objectIsLoaded | async"
>
<app-object-display
<app-object-display
[datasetName]=
"datasetName |
async"
[datasetName]=
"datasetName |
async"
[outputFamilyList]=
"outputFamilyList |
async"
[outputFamilyList]=
"outputFamilyList |
async"
[categoryList]=
"categoryList |
async"
[categoryList]=
"categoryList |
async"
[attributeList]=
"attributeList |
async"
[attributeList]=
"attributeList |
async"
[object]=
"object |
async"
[object]=
"object |
async"
[spectraIsLoading]=
"spectraIsLoading | async"
[spectraIsLoading]=
"spectraIsLoading | async"
[spectraIsLoaded]=
"spectraIsLoaded | async"
[spectraIsLoaded]=
"spectraIsLoaded | async"
[spectraCSV]=
"spectraCSV | async"
[spectraCSV]=
"spectraCSV | async"
...
...
This diff is collapsed.
Click to expand it.
src/app/detail/containers/detail.component.spec.ts
0 → 100644
+
84
−
0
View file @
e615e272
import
{
ComponentFixture
,
TestBed
,
async
,
inject
}
from
'
@angular/core/testing
'
;
import
{
provideMockStore
,
MockStore
}
from
'
@ngrx/store/testing
'
;
import
{
Component
,
InjectionToken
,
Input
}
from
'
@angular/core
'
;
import
{
Location
}
from
'
@angular/common
'
;
import
{
DetailComponent
}
from
'
./detail.component
'
;
import
*
as
fromDetail
from
'
../store/detail.reducer
'
;
import
*
as
detailActions
from
'
../store/detail.action
'
;
import
{
Attribute
,
Family
,
Category
}
from
'
src/app/metamodel/model
'
;
describe
(
'
[Search] Container: DetailComponent
'
,
()
=>
{
@
Component
({
selector
:
'
app-object-display
'
,
template
:
''
})
class
ObjectDisplayStubComponent
{
@
Input
()
datasetName
:
string
;
@
Input
()
outputFamilyList
:
Family
[];
@
Input
()
categoryList
:
Category
[];
@
Input
()
attributeList
:
Attribute
[];
@
Input
()
object
:
any
;
@
Input
()
spectraIsLoading
:
boolean
;
@
Input
()
spectraIsLoaded
:
boolean
;
@
Input
()
spectraCSV
:
string
;
}
let
component
:
DetailComponent
;
let
fixture
:
ComponentFixture
<
DetailComponent
>
;
let
store
:
MockStore
;
const
initialState
=
{
detail
:
{
...
fromDetail
.
initialState
}
};
const
LOCATION_TOKEN
=
new
InjectionToken
<
Location
>
(
'
Window location object
'
);
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
DetailComponent
,
ObjectDisplayStubComponent
],
providers
:
[
provideMockStore
({
initialState
}),
{
provide
:
LOCATION_TOKEN
,
useValue
:
window
.
history
}
]
});
fixture
=
TestBed
.
createComponent
(
DetailComponent
);
component
=
fixture
.
componentInstance
;
store
=
TestBed
.
inject
(
MockStore
);
}));
it
(
'
should create the component
'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
it
(
'
should execute ngOnInit lifecycle
'
,
(
done
)
=>
{
const
initDetailAction
=
new
detailActions
.
InitDetailAction
();
const
spy
=
spyOn
(
store
,
'
dispatch
'
);
component
.
ngOnInit
();
Promise
.
resolve
(
null
).
then
(
function
()
{
expect
(
spy
).
toHaveBeenCalledTimes
(
1
);
expect
(
spy
).
toHaveBeenCalledWith
(
initDetailAction
);
done
();
});
});
it
(
"
#goBackToResult() should go to the previous location
"
,
inject
([
LOCATION_TOKEN
],
(
location
:
Location
)
=>
{
spyOn
(
location
,
'
back
'
);
component
.
goBackToResult
();
expect
(
location
.
back
).
toHaveBeenCalledTimes
(
1
);
}));
it
(
'
#getSpectraCSV() should dispatch RetrieveSpectraAction
'
,
()
=>
{
const
retrieveSpectraAction
=
new
detailActions
.
RetrieveSpectraAction
(
'
toto
'
);
const
spy
=
spyOn
(
store
,
'
dispatch
'
);
component
.
getSpectraCSV
(
'
toto
'
);
expect
(
spy
).
toHaveBeenCalledTimes
(
1
);
expect
(
spy
).
toHaveBeenCalledWith
(
retrieveSpectraAction
);
});
it
(
'
#ngOnDestroy() should dispatch DestroyDetailAction
'
,
()
=>
{
const
destroyDetailAction
=
new
detailActions
.
DestroyDetailAction
();
const
spy
=
spyOn
(
store
,
'
dispatch
'
);
component
.
ngOnDestroy
();
expect
(
spy
).
toHaveBeenCalledTimes
(
1
);
expect
(
spy
).
toHaveBeenCalledWith
(
destroyDetailAction
);
});
});
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