Skip to content

Instantly share code, notes, and snippets.

@Teebo
Created January 31, 2021 12:53
Show Gist options
  • Save Teebo/6d8a10b4db73357d90e9b240464da3d3 to your computer and use it in GitHub Desktop.
Save Teebo/6d8a10b4db73357d90e9b240464da3d3 to your computer and use it in GitHub Desktop.
HobbiesComponent tests
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ControlContainer, FormBuilder, Validators } from '@angular/forms';
import { HobbiesComponent } from './hobbies.component';
describe('HobbiesComponent', () => {
let component: HobbiesComponent;
let fixture: ComponentFixture<HobbiesComponent>;
const formBuidler: FormBuilder = new FormBuilder();
const hobbyForm = formBuidler.group({
favoriteHobby: ['', Validators.required]
})
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [HobbiesComponent],
providers: [{ provide: ControlContainer, useValue: hobbyForm }],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HobbiesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment