-
-
Notifications
You must be signed in to change notification settings - Fork 185
Open
Description
Is this a regression?
No
Description
I'm trying to mock a child component in a standalone component that uses Routerlink. Because of the Routerlink, I am using createRoutingFactory
in my test. But I have discovered that mocking the child component using the componentImports
attribute doesn't work. Mocking does work with overrideComponents
.
So:
const createComponent = createRoutingFactory({
component: TestedStandaloneComponent,
componentImports: [[ChildComponent, MockComponent(ChildComponent)]],
});
fails to mock the ChildComponent
And:
const createComponent = createRoutingFactory({
component: TestedStandaloneComponent,
overrideComponents: [
[
TestedStandaloneComponent,
{
remove: {
imports: [ChildComponent],
},
add: {
imports: [MockComponent(ChildComponent)],
},
},
],
],
});
Does successfully mock the ChildComponent
. But I find this a bit to verbose :).
Using the latest version ("@ngneat/spectator": "^21.0.1") and importing from import { Spectator, createRoutingFactory } from '@ngneat/spectator/jest';
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in
Anything else?
No response
Do you want to create a pull request?
No
Metadata
Metadata
Assignees
Labels
No labels