Questions tagged [ng-mocks]
40 questions
1
vote
1 answer
Angular component test with spectator logs "can't bind to input" warnings for mocked child component
I'm facing an issue mocking a child component in an Angular 9 component test using @ngneat/spectator. The mocking and passing of the mock work fine, but it throws warnings in the logs for the inputs (even though they are valid).
The simplified…

bbop99
- 1,625
- 1
- 11
- 25
1
vote
0 answers
Error testing any component with Ionic ion-infinite-scroll as child (Ionic 4)
First off, this isn't a breaking issue, but I do not like the fact that running my unit tests is presenting an error. So anyways, if you create a page/component with Ionic and use the ion-infinite-scroll component, and then proceed to unit test this…

SpellChucker
- 450
- 5
- 18
0
votes
1 answer
Angular CDK Overlay not appearing in Jest snapshot
I'm writing an integration test for an Angular Component / module using Jest and ngMocks.
One of the functions I'm testing uses the CDK overlay to display some important inputs that I want to select to do further steps.
However, the CDK overlay…

Ewan
- 378
- 3
- 14
0
votes
1 answer
NgMocks: cannot write test for canActivate guard
I'm implementing tests for a simple canActivate guard. See below:
// guard
export const hasGraphResultsCanActiveGuard: CanActivateFn = (
route: ActivatedRouteSnapshot,
routerState: RouterStateSnapshot
) => {
return inject(Store)
…

JDillon522
- 19,046
- 15
- 47
- 81
0
votes
0 answers
Angular: Test code in a module's constructor with NgMocks
I have a simple notifications module that uses material's snack bar while listening on an Ngrx Selector. I dont have any components and work is done in the module's constructor so the consumer only needs to import the module and then dispatch a new…

JDillon522
- 19,046
- 15
- 47
- 81
0
votes
2 answers
Cannot trigger click event undefined element
I need to test click event on mat-table row. Below is my mat-table code