import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; import { CommentComponent } from './comment.component'; import { EventEmitter } from '@angular/core'; describe('CommentComponent', () => { let component: CommentComponent; let fixture: ComponentFixture; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [CommentComponent], imports: [], }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(CommentComponent); component = fixture.componentInstance; component.updatedComment = new EventEmitter(); fixture.detectChanges(); }); it('should call onCommentChanged', () => { component.updatedComment.emit = jest.fn(); const event = { target: { value: 'some value', }, }; component.onCommentChanged(event); expect(component.updatedComment.emit).toHaveBeenCalled(); }); it('should create', () => { expect(component).toBeTruthy(); }); });