Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
7934b873
Commit
7934b873
authored
6 years ago
by
Kristof De Langhe
Browse files
Options
Downloads
Patches
Plain Diff
55693: ItemSelectService tests
parent
8b99ea44
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/shared/item-select/item-select.component.spec.ts
+1
-1
1 addition, 1 deletion
src/app/shared/item-select/item-select.component.spec.ts
src/app/shared/item-select/item-select.service.spec.ts
+96
-0
96 additions, 0 deletions
src/app/shared/item-select/item-select.service.spec.ts
with
97 additions
and
1 deletion
src/app/shared/item-select/item-select.component.spec.ts
+
1
−
1
View file @
7934b873
...
...
@@ -21,7 +21,7 @@ import { LocationStrategy } from '@angular/common';
import
{
MockLocationStrategy
}
from
'
@angular/common/testing
'
;
import
{
RouterTestingModule
}
from
'
@angular/router/testing
'
;
f
describe
(
'
ItemSelectComponent
'
,
()
=>
{
describe
(
'
ItemSelectComponent
'
,
()
=>
{
let
comp
:
ItemSelectComponent
;
let
fixture
:
ComponentFixture
<
ItemSelectComponent
>
;
let
itemSelectService
:
ItemSelectService
;
...
...
This diff is collapsed.
Click to expand it.
src/app/shared/item-select/item-select.service.spec.ts
0 → 100644
+
96
−
0
View file @
7934b873
import
{
ItemSelectService
}
from
'
./item-select.service
'
;
import
{
Store
}
from
'
@ngrx/store
'
;
import
{
Observable
}
from
'
rxjs/Observable
'
;
import
{
ItemSelectionsState
}
from
'
./item-select.reducer
'
;
import
{
AppState
}
from
'
../../app.reducer
'
;
import
{
ItemSelectionDeselectAction
,
ItemSelectionInitialDeselectAction
,
ItemSelectionInitialSelectAction
,
ItemSelectionResetAction
,
ItemSelectionSelectAction
,
ItemSelectionSwitchAction
}
from
'
./item-select.actions
'
;
describe
(
'
ItemSelectService
'
,
()
=>
{
let
service
:
ItemSelectService
;
const
mockItemId
=
'
id1
'
;
const
store
:
Store
<
ItemSelectionsState
>
=
jasmine
.
createSpyObj
(
'
store
'
,
{
/* tslint:disable:no-empty */
dispatch
:
{},
/* tslint:enable:no-empty */
select
:
Observable
.
of
(
true
)
});
const
appStore
:
Store
<
AppState
>
=
jasmine
.
createSpyObj
(
'
appStore
'
,
{
/* tslint:disable:no-empty */
dispatch
:
{},
/* tslint:enable:no-empty */
select
:
Observable
.
of
(
true
)
});
beforeEach
(()
=>
{
service
=
new
ItemSelectService
(
store
,
appStore
);
});
describe
(
'
when the initialSelect method is triggered
'
,
()
=>
{
beforeEach
(()
=>
{
service
.
initialSelect
(
mockItemId
);
});
it
(
'
ItemSelectionInitialSelectAction should be dispatched to the store
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
new
ItemSelectionInitialSelectAction
(
mockItemId
));
});
});
describe
(
'
when the initialDeselect method is triggered
'
,
()
=>
{
beforeEach
(()
=>
{
service
.
initialDeselect
(
mockItemId
);
});
it
(
'
ItemSelectionInitialDeselectAction should be dispatched to the store
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
new
ItemSelectionInitialDeselectAction
(
mockItemId
));
});
});
describe
(
'
when the select method is triggered
'
,
()
=>
{
beforeEach
(()
=>
{
service
.
select
(
mockItemId
);
});
it
(
'
ItemSelectionSelectAction should be dispatched to the store
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
new
ItemSelectionSelectAction
(
mockItemId
));
});
});
describe
(
'
when the deselect method is triggered
'
,
()
=>
{
beforeEach
(()
=>
{
service
.
deselect
(
mockItemId
);
});
it
(
'
ItemSelectionDeselectAction should be dispatched to the store
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
new
ItemSelectionDeselectAction
(
mockItemId
));
});
});
describe
(
'
when the switch method is triggered
'
,
()
=>
{
beforeEach
(()
=>
{
service
.
switch
(
mockItemId
);
});
it
(
'
ItemSelectionSwitchAction should be dispatched to the store
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
new
ItemSelectionSwitchAction
(
mockItemId
));
});
});
describe
(
'
when the reset method is triggered
'
,
()
=>
{
beforeEach
(()
=>
{
service
.
reset
();
});
it
(
'
ItemSelectionInitialSelectAction should be dispatched to the store
'
,
()
=>
{
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
new
ItemSelectionResetAction
(
null
));
});
});
});
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