I'm trying to start using unit testing in my project. When I run tests for my existing component: AddAnnouncementComponent I get errors like:
If 'mat-spinner' is an Angular component, then verify that it is part of this module.
The problem is, there are hundreds of these errors. It mainly affects angular material elements but not only. Is there a simple way to fix that so I can use testing in my old, existing components? My .spec.ts file for this component:
import { AddAnnouncementComponent } from "./add-announcement.component";
describe("AddAnnouncementComponent", () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [],
declarations: [AddAnnouncementComponent],
}).compileComponents();
}));
it("should create the app", async(() => {
const fixture = TestBed.createComponent(AddAnnouncementComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
});
Aucun commentaire:
Enregistrer un commentaire