Mocking modules with entry components
See original GitHub issueI’m trying to mock a Module which contains an entry component (used for a MatDialog
), but MockModule
seems to erase in some way the original entryComponents
definition.
Is it intended behaviour?
@NgModule({
declarations: [MyComponent],
entryComponents: [MyComponent]
})
class TestModule {}
// From https://github.com/NetanelBasal/spectator
const spectator = createService({
service: MyService,
imports: [NoopAnimationsModule, MatDialogModule, MockModule(TestModule)]
});
I get No component factory found for MyComponent. Did you add it to @NgModule.entryComponents?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Mocking modules with entry components · Issue #51 - GitHub
I'm trying to mock a Module which contains an entry component (used for a MatDialog), but MockModule seems to erase in some way...
Read more >Providing "entryComponents" for a TestBed - Stack Overflow
I'm trying to write a unit test and pass some TestComponent for it to create & render. TestBed . configureTestingModule(<any>{ declarations: [ ...
Read more >Mock Imported React Components and ES Modules With Jest
Testing a React component can requires to control its imports, usually by mocking them. Several strategies are possible for this. Here is how...
Read more >Mocking Components in Angular - Braydon Coyer
In Angular, a module is a mechanism to group components, directives, pipes and services that are related, in such a way that can...
Read more >Jest Full and Partial Mock/Spy of CommonJS and ES6 Module ...
Spying/Stubbing calls to internal module functions with Jest ... Concept: “calling through” (as opposed to mocking). An internal/private/helper ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @IlCallo ,
I added entryComponents to mocked modules and it was released in https://github.com/ike18t/ng-mocks/releases/tag/v7.8.0
Added fix to the same PR, it requires to avoid mock of the ‘InjectionToken HammerGestureConfig’ provider.