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
export function createCollaboration(): Collaboration {
return {
titel: faker.word.sample(2),
anfrage: faker.word.sample(10),
beschreibung: faker.word.sample(10),
zustaendigeStelle: faker.internet.url(),
};
}
......
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();
});
......
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();
});
......
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);
}));
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment