When I run ng c my-component, I get a spec file that has 2 beforeEach methods.
describe('MyComponent', () => {
let component: MyComponent;
let fixture: ComponentFixture<MyComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MyComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Why do I have 2 beforeEach, do I need both of them? All the tutorial are showing only the second, i.e. the non-asynchronous one. Also code needed to run a basic test is split among those 2 methods. Any reason?
Thanks for helping.