Załóżmy, że masz następujący komponent:Jak wypróbować testowanie komponentu za pomocą `entryComponents`?
import { Another } from "./Another";
@Component({
entryComponents: [
Another
]
})
export class App {}
Nawet podczas korzystania NO_ERRORS_SCHEMA
wciąż muszę to Another
jako część deklaracji Test:
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { App } from "./App";
import { Another } from "./Another";
describe("App",() => {
let comp: App;
let fixture: ComponentFixture<App>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ App, Another ],
schemas: [ NO_ERRORS_SCHEMA ]
});
fixture = TestBed.createComponent(App);
comp = fixture.componentInstance;
});
it("can load instance",() => {
expect(comp).toBeTruthy();
});
});