Questions tagged [ngrx-test]
6 questions
2
votes
0 answers
Angular Unit Test Component with Store selector with subscribe
Am using using ngrx sectors to get the data from store. Here is my code.
component file
export class SpinnerComponent implements OnInit {
isLoading = false;
constructor(private readonly store$: Store) { }
ngOnInit(): void {
…

arj
- 887
- 1
- 15
- 37
1
vote
2 answers
Use SpyOn on provider that has string value
I have a class that I am trying to test. The class has a service Injected in as such:
constructor(private actions$: Actions, @Inject('NotificationHandlerService') private notificationService: INotificationHandlerService) {}
In the spec.ts I…

Chirag Patel
- 364
- 2
- 12
1
vote
2 answers
Testing NGRX effect that emits action with delay OR does not emit anything
I have an NGRX effect that - depending on the state - emits an action with a delay or it emits nothing.
I want to write a test, covering both situations.
This is the effect:
myEffect$ = createEffect(() =>
this.actions$.pipe(
ofType(MyAction),
…

Jan
- 191
- 6
1
vote
0 answers
Problem with Store Dependent Effect Unit-Test
this is my first approach to unit test effects and I don't know how to write test for my Store Dependent Effect, here is the effect code:
validaCellulare$ = createEffect(() =>
this.actions$.pipe(
ofType(checkPIvaSuccess,…

Giuseppe Zappulla
- 11
- 2
0
votes
0 answers
Test cases for Angular Components with Ngrx Store
I want to write test case for the following .I have tried with the following code but didnt work at all.
Been Searching for this since few hours but no solution.
ngOnInit(): void {
this.isDarkTheme$ = this.themeService.getDarkTheme();
…

Ajax S
- 1
- 2
0
votes
2 answers
TypeError: reducerManager.addFeatures is not a function
I am trying to write the test with spec file, butting an error as:
TypeError: Cannot read property 'loading' of undefined - not able to understand either fix it out.
any one help me here?
here is my spec.ts file:
import { async, ComponentFixture,…

3gwebtrain
- 14,640
- 25
- 121
- 247