我正在尝试测试我的应用,但添加路由后无法执行。现在,我有该测试
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent,
NavbarComponent,
IndexComponent,
ProjectsComponent,
BioComponent,
SiteComponent,
SiteItemComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
});
在每个地方都写着值得添加RouterTestingModule
,但是它是从Angular CLI生成开始就添加的。