angular 6(別名angular)でのテストは初めてで、これまでに見たすべてのテストを再評価することに1つの懸念があります。
まず、単純なコンポーネント (cli によって生成される) の単純なテストを見てみましょう。
describe('CompComponent', () => {
let component: CompComponent;
let fixture: ComponentFixture<CompComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CompComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CompComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
主な質問が 1 つあります。
1.各 Async beforeEach 呼び出しが各テストユニット (別名) の前に行われることを確実に知るにはどうすればよいですか? 結局、非同期呼び出しであるため、この呼び出しが毎回発生する場合はありますか?