Created
January 31, 2021 12:53
-
-
Save Teebo/6d8a10b4db73357d90e9b240464da3d3 to your computer and use it in GitHub Desktop.
HobbiesComponent tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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