Select Git revision
create-bescheid-button.component.spec.ts
create-bescheid-button.component.spec.ts 1.33 KiB
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { dispatchEventFromFixture } from '@alfa-client/test-utils';
import { IconButtonWithSpinnerComponent } from '@alfa-client/ui';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { CreateBescheidButtonComponent } from './create-bescheid-button.component';
describe('CreateBescheidButtonComponent', () => {
let component: CreateBescheidButtonComponent;
let fixture: ComponentFixture<CreateBescheidButtonComponent>;
const createBescheidButton: string = getDataTestIdOf('create-bescheid-icon-button');
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [CreateBescheidButtonComponent, MockComponent(IconButtonWithSpinnerComponent)],
}).compileComponents();
fixture = TestBed.createComponent(CreateBescheidButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
describe('on button click', () => {
it('should emit createBescheid', () => {
jest.spyOn(component.createBescheid, 'emit');
dispatchEventFromFixture(fixture, createBescheidButton, 'clickEmitter');
expect(component.createBescheid.emit).toHaveBeenCalled();
});
});
});