From 972a318634ee1919c47714edfb0fac4102a37517 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Fri, 29 Nov 2024 11:58:50 +0100 Subject: [PATCH] OZG-6477 fix tests --- .../libs/collaboration-shared/test/collaboration.ts | 2 +- .../collaboration-request.component.spec.ts | 11 ++++++++--- .../externe-fachstelle-list-item.component.spec.ts | 11 ++++++++--- ...ons-einheit-list-item-container.component.spec.ts | 12 ++++++++---- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/alfa-client/libs/collaboration-shared/test/collaboration.ts b/alfa-client/libs/collaboration-shared/test/collaboration.ts index da923fb34b..6eb8cfcd78 100644 --- a/alfa-client/libs/collaboration-shared/test/collaboration.ts +++ b/alfa-client/libs/collaboration-shared/test/collaboration.ts @@ -9,7 +9,7 @@ import { Collaboration, CollaborationListResource, CollaborationResource } from export function createCollaboration(): Collaboration { return { titel: faker.word.sample(2), - anfrage: faker.word.sample(10), + beschreibung: faker.word.sample(10), zustaendigeStelle: faker.internet.url(), }; } diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-list-container/collaboration-request/collaboration-request.component.spec.ts b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-list-container/collaboration-request/collaboration-request.component.spec.ts index 475110f0be..f71e021098 100644 --- a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-list-container/collaboration-request/collaboration-request.component.spec.ts +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-list-container/collaboration-request/collaboration-request.component.spec.ts @@ -1,19 +1,24 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { CollaborationResource } from '@alfa-client/collaboration-shared'; +import { createCollaboration } from 'libs/collaboration-shared/test/collaboration'; +import { toResource } from 'libs/tech-shared/test/resource'; import { CollaborationRequestComponent } from './collaboration-request.component'; describe('CollaborationRequestComponent', () => { let component: CollaborationRequestComponent; let fixture: ComponentFixture<CollaborationRequestComponent>; + const collaboration: CollaborationResource = toResource(createCollaboration()); + beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [CollaborationRequestComponent] - }) - .compileComponents(); + declarations: [CollaborationRequestComponent], + }).compileComponents(); fixture = TestBed.createComponent(CollaborationRequestComponent); component = fixture.componentInstance; + component.collaboration = collaboration; fixture.detectChanges(); }); diff --git a/alfa-client/libs/externe-fachstelle/src/lib/externe-fachstelle-list-item-container/externe-fachstelle-list-item/externe-fachstelle-list-item.component.spec.ts b/alfa-client/libs/externe-fachstelle/src/lib/externe-fachstelle-list-item-container/externe-fachstelle-list-item/externe-fachstelle-list-item.component.spec.ts index 2f29f74af1..b9d04c2a49 100644 --- a/alfa-client/libs/externe-fachstelle/src/lib/externe-fachstelle-list-item-container/externe-fachstelle-list-item/externe-fachstelle-list-item.component.spec.ts +++ b/alfa-client/libs/externe-fachstelle/src/lib/externe-fachstelle-list-item-container/externe-fachstelle-list-item/externe-fachstelle-list-item.component.spec.ts @@ -1,19 +1,24 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ExterneFachstelleResource } from '@alfa-client/zustaendige-stelle-shared'; +import { toResource } from 'libs/tech-shared/test/resource'; +import { createExterneFachstelle } from 'libs/zustaendige-stelle-shared/test/externe-fachstelle'; import { ExterneFachstelleListItemComponent } from './externe-fachstelle-list-item.component'; describe('ExterneFachstelleListItemComponent', () => { let component: ExterneFachstelleListItemComponent; let fixture: ComponentFixture<ExterneFachstelleListItemComponent>; + const externeFachstelle: ExterneFachstelleResource = toResource(createExterneFachstelle()); + beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ExterneFachstelleListItemComponent] - }) - .compileComponents(); + imports: [ExterneFachstelleListItemComponent], + }).compileComponents(); fixture = TestBed.createComponent(ExterneFachstelleListItemComponent); component = fixture.componentInstance; + component.externeFachstelle = externeFachstelle; fixture.detectChanges(); }); diff --git a/alfa-client/libs/organisations-einheit/src/lib/organisations-einheit-list-item-container/organisations-einheit-list-item-container.component.spec.ts b/alfa-client/libs/organisations-einheit/src/lib/organisations-einheit-list-item-container/organisations-einheit-list-item-container.component.spec.ts index b45ef3e020..299f0da625 100644 --- a/alfa-client/libs/organisations-einheit/src/lib/organisations-einheit-list-item-container/organisations-einheit-list-item-container.component.spec.ts +++ b/alfa-client/libs/organisations-einheit/src/lib/organisations-einheit-list-item-container/organisations-einheit-list-item-container.component.spec.ts @@ -1,6 +1,8 @@ -import { createStateResource } from '@alfa-client/tech-shared'; +import { createStateResource, StateResource } from '@alfa-client/tech-shared'; import { mock, Mock } from '@alfa-client/test-utils'; +import { OrganisationsEinheitResource } from '@alfa-client/zustaendige-stelle-shared'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { toResource } from 'libs/tech-shared/test/resource'; import { ZustaendigeStelleResourceService } from 'libs/zustaendige-stelle-shared/src/lib/zustaendige-stelle-resource.service'; import { createOrganisationsEinheit } from 'libs/zustaendige-stelle-shared/test/organisations-einheit'; import { of } from 'rxjs'; @@ -12,12 +14,14 @@ describe('OrganisationsEinheitListItemContainerComponent', () => { let zustaendigeStelleResourceService: Mock<ZustaendigeStelleResourceService>; - const organisationsEinheit = createOrganisationsEinheit(); + const organisationsEinheit: OrganisationsEinheitResource = toResource(createOrganisationsEinheit()); + const organisationsEInheitStateResource: StateResource<OrganisationsEinheitResource> = + createStateResource(organisationsEinheit); beforeEach(async () => { zustaendigeStelleResourceService = { ...mock(ZustaendigeStelleResourceService), - getLinkedResource: jest.fn().mockReturnValue(of(createStateResource(organisationsEinheit))), + getLinkedResource: jest.fn().mockReturnValue(of(organisationsEInheitStateResource)), }; await TestBed.configureTestingModule({ imports: [OrganisationsEinheitListItemContainerComponent] }) @@ -58,7 +62,7 @@ describe('OrganisationsEinheitListItemContainerComponent', () => { component.ngOnInit(); tick(); - expect(component.organisationsEinheit).toBe(organisationsEinheit); + expect(component.organisationsEinheitStateResource.resource).toBe(organisationsEinheit); })); }); }); -- GitLab