Skip to content
Snippets Groups Projects
Commit 972a3186 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6477 fix tests

parent 14228087
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ import { Collaboration, CollaborationListResource, CollaborationResource } from ...@@ -9,7 +9,7 @@ import { Collaboration, CollaborationListResource, CollaborationResource } from
export function createCollaboration(): Collaboration { export function createCollaboration(): Collaboration {
return { return {
titel: faker.word.sample(2), titel: faker.word.sample(2),
anfrage: faker.word.sample(10), beschreibung: faker.word.sample(10),
zustaendigeStelle: faker.internet.url(), zustaendigeStelle: faker.internet.url(),
}; };
} }
......
import { ComponentFixture, TestBed } from '@angular/core/testing'; 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'; import { CollaborationRequestComponent } from './collaboration-request.component';
describe('CollaborationRequestComponent', () => { describe('CollaborationRequestComponent', () => {
let component: CollaborationRequestComponent; let component: CollaborationRequestComponent;
let fixture: ComponentFixture<CollaborationRequestComponent>; let fixture: ComponentFixture<CollaborationRequestComponent>;
const collaboration: CollaborationResource = toResource(createCollaboration());
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [CollaborationRequestComponent] declarations: [CollaborationRequestComponent],
}) }).compileComponents();
.compileComponents();
fixture = TestBed.createComponent(CollaborationRequestComponent); fixture = TestBed.createComponent(CollaborationRequestComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.collaboration = collaboration;
fixture.detectChanges(); fixture.detectChanges();
}); });
......
import { ComponentFixture, TestBed } from '@angular/core/testing'; 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'; import { ExterneFachstelleListItemComponent } from './externe-fachstelle-list-item.component';
describe('ExterneFachstelleListItemComponent', () => { describe('ExterneFachstelleListItemComponent', () => {
let component: ExterneFachstelleListItemComponent; let component: ExterneFachstelleListItemComponent;
let fixture: ComponentFixture<ExterneFachstelleListItemComponent>; let fixture: ComponentFixture<ExterneFachstelleListItemComponent>;
const externeFachstelle: ExterneFachstelleResource = toResource(createExterneFachstelle());
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [ExterneFachstelleListItemComponent] imports: [ExterneFachstelleListItemComponent],
}) }).compileComponents();
.compileComponents();
fixture = TestBed.createComponent(ExterneFachstelleListItemComponent); fixture = TestBed.createComponent(ExterneFachstelleListItemComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.externeFachstelle = externeFachstelle;
fixture.detectChanges(); fixture.detectChanges();
}); });
......
import { createStateResource } from '@alfa-client/tech-shared'; import { createStateResource, StateResource } from '@alfa-client/tech-shared';
import { mock, Mock } from '@alfa-client/test-utils'; 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 { 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 { ZustaendigeStelleResourceService } from 'libs/zustaendige-stelle-shared/src/lib/zustaendige-stelle-resource.service';
import { createOrganisationsEinheit } from 'libs/zustaendige-stelle-shared/test/organisations-einheit'; import { createOrganisationsEinheit } from 'libs/zustaendige-stelle-shared/test/organisations-einheit';
import { of } from 'rxjs'; import { of } from 'rxjs';
...@@ -12,12 +14,14 @@ describe('OrganisationsEinheitListItemContainerComponent', () => { ...@@ -12,12 +14,14 @@ describe('OrganisationsEinheitListItemContainerComponent', () => {
let zustaendigeStelleResourceService: Mock<ZustaendigeStelleResourceService>; let zustaendigeStelleResourceService: Mock<ZustaendigeStelleResourceService>;
const organisationsEinheit = createOrganisationsEinheit(); const organisationsEinheit: OrganisationsEinheitResource = toResource(createOrganisationsEinheit());
const organisationsEInheitStateResource: StateResource<OrganisationsEinheitResource> =
createStateResource(organisationsEinheit);
beforeEach(async () => { beforeEach(async () => {
zustaendigeStelleResourceService = { zustaendigeStelleResourceService = {
...mock(ZustaendigeStelleResourceService), ...mock(ZustaendigeStelleResourceService),
getLinkedResource: jest.fn().mockReturnValue(of(createStateResource(organisationsEinheit))), getLinkedResource: jest.fn().mockReturnValue(of(organisationsEInheitStateResource)),
}; };
await TestBed.configureTestingModule({ imports: [OrganisationsEinheitListItemContainerComponent] }) await TestBed.configureTestingModule({ imports: [OrganisationsEinheitListItemContainerComponent] })
...@@ -58,7 +62,7 @@ describe('OrganisationsEinheitListItemContainerComponent', () => { ...@@ -58,7 +62,7 @@ describe('OrganisationsEinheitListItemContainerComponent', () => {
component.ngOnInit(); component.ngOnInit();
tick(); tick();
expect(component.organisationsEinheit).toBe(organisationsEinheit); expect(component.organisationsEinheitStateResource.resource).toBe(organisationsEinheit);
})); }));
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment