Skip to content
Snippets Groups Projects
Select Git revision
  • 0b0f15b1b35a6194b39591117b87ec83ef0e10e6
  • main default protected
  • release
  • OZG-7856_schadcode_scanner
  • ci-pipeline
  • OZG-7526-signatur-nicht-uebernommen
  • OZG-6223-zip-download-bug
  • OZG-7367-tooltip-extension
  • OZG-7023-OZG-6956-E2E-externe-Stellen
  • OZG-6238-npm-durch-pnpm-ersetzen
  • release-admin
  • release-info
  • OZG-6700-admin-feature-toggle
  • E2E-Updates
  • OZG-7047-tooltips
  • OZG-6957-e2e-fachstellen-oe-daten
  • OZG-7006-ZuarbeitAnfragen
  • temp_OZG-7027
  • unit-tests-hotfix
  • OZG-6731-POC-keycloakResourceService-with-multiple-stateResources
  • e2e-add-zufi-version
  • 2.26.0
  • 2.25.0
  • 2.24.2
  • 2.24.1
  • 2.24.0
  • 2.23.0
  • 2.22.0
  • 2.21.0
  • 2.20.0
  • 2.21.0-SNAPSHOT
  • 2.19.0
  • 2.18.0
  • 2.17.1
  • 1.3.0
  • release-admin-1.3.0
  • release-info-1.3.0
  • 2.17.0
  • 2.16.0
  • 2.15.0
  • release-admin-1.1.0
41 results

create-bescheid-button-container.component.spec.ts

Blame
  • create-bescheid-button-container.component.spec.ts 2.16 KiB
    import { ComponentFixture, TestBed } from '@angular/core/testing';
    import { Mock, dispatchEventFromFixture, mock } from '@alfa-client/test-utils';
    import { VorgangWithEingangResource } from '@alfa-client/vorgang-shared';
    import { BescheidService } from 'libs/bescheid-shared/src/lib/bescheid.service';
    import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
    import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang';
    import { MockComponent } from 'ng-mocks';
    import { CreateBescheidButtonContainerComponent } from './create-bescheid-button-container.component';
    import { CreateBescheidButtonComponent } from './create-bescheid-button/create-bescheid-button.component';
    
    describe('CreateBescheidButtonContainerComponent', () => {
      let component: CreateBescheidButtonContainerComponent;
      let fixture: ComponentFixture<CreateBescheidButtonContainerComponent>;
    
      const createBescheidComponent: string = getDataTestIdOf('create-bescheid-button-component');
      const service: Mock<BescheidService> = mock(BescheidService);
      const vorgangWithEingang: VorgangWithEingangResource = createVorgangWithEingangResource();
    
      beforeEach(async () => {
        await TestBed.configureTestingModule({
          declarations: [
            CreateBescheidButtonContainerComponent,
            MockComponent(CreateBescheidButtonComponent),
          ],
          providers: [
            {
              provide: BescheidService,
              useValue: service,
            },
          ],
        }).compileComponents();
    
        fixture = TestBed.createComponent(CreateBescheidButtonContainerComponent);
        component = fixture.componentInstance;
        component.vorgangWithEingang = vorgangWithEingang;
        fixture.detectChanges();
      });
    
      it('should create', () => {
        expect(component).toBeTruthy();
      });
    
      describe('ngOnInit', () => {
        it('should get bescheid command', () => {
          component.ngOnInit();
    
          expect(service.getBescheidCommand).toHaveBeenCalled();
        });
      });
    
      describe('create', () => {
        it('should call service', () => {
          dispatchEventFromFixture(fixture, createBescheidComponent, 'createBescheid');
    
          expect(service.createBescheid).toHaveBeenCalledWith(vorgangWithEingang);
        });
      });
    });