I am using ng-mocks with Angular. While running the test case, I am getting below error
console.error NG0304: 'ng-mocks-ButtonComponent' is not a known element (used in the 'i' component > template):
- If 'ng-mocks-ButtonComponent' is an Angular component, then verify that it is a part > of an @NgModule where this component is declared.
- If 'ng-mocks-ButtonComponent' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to > the '@NgModule.schemas' of this component to suppress this message.
describe('ButtonComponent', () => {
beforeEach(() => {
return MockBuilder(ButtonComponent, ButtonModule);
});
it('should create', () => {
const fixture = MockRender(ButtonComponent);
expect(fixture.point.componentInstance).toBeDefined();
});
it('should have icon as input decorator for the button component', () => {
const fixture = MockRender(ButtonComponent);
expect(fixture.point.componentInstance.icon).toBeDefined();
});
This issue has been reported and fixed already: https://github.com/help-me-mom/ng-mocks/issues/3515
Please upgrade ng-mock
to the latest version.