diff --git a/alfa-client/libs/collaboration-shared/src/lib/collaboration.service.spec.ts b/alfa-client/libs/collaboration-shared/src/lib/collaboration.service.spec.ts index 3ad660af24dfd54fbe6a5b7368f2fe66e064aa4d..80d2dfbf9677d35d265488b3a1d38fa87679ae4b 100644 --- a/alfa-client/libs/collaboration-shared/src/lib/collaboration.service.spec.ts +++ b/alfa-client/libs/collaboration-shared/src/lib/collaboration.service.spec.ts @@ -46,6 +46,14 @@ describe('CollaborationService', () => { }); }); + describe('refresh list', () => { + it('should call service', () => { + service.refreshList(); + + expect(listService.refresh).toHaveBeenCalled(); + }); + }); + describe('organisationsEinheit', () => { describe('is form visible', () => { it('should return value', (done) => { diff --git a/alfa-client/libs/collaboration-shared/src/lib/collaboration.service.ts b/alfa-client/libs/collaboration-shared/src/lib/collaboration.service.ts index 5e3a4bddae93de877988896523a9132e676c6575..d2e60c0515268430439e460b8916d80b53dab1dc 100644 --- a/alfa-client/libs/collaboration-shared/src/lib/collaboration.service.ts +++ b/alfa-client/libs/collaboration-shared/src/lib/collaboration.service.ts @@ -28,6 +28,10 @@ export class CollaborationService { return this.listService.getList(); } + public refreshList(): void { + this.listService.refresh(); + } + public isOrganisationsEinheitFormVisible(): Observable<boolean> { return this.showOrganisationsEinheitForm$.asObservable(); } diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-request-form/collaboration.request.formservice.spec.ts b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-request-form/collaboration.request.formservice.spec.ts index 989607ccc531c76d5db317ed591f0d8d60d865f6..4820b2987eddad0fea076dbf9d94c391f19735f3 100644 --- a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-request-form/collaboration.request.formservice.spec.ts +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-request-form/collaboration.request.formservice.spec.ts @@ -1,5 +1,5 @@ import { CollaborationListResource } from '@alfa-client/collaboration-shared'; -import { CommandResource } from '@alfa-client/command-shared'; +import { CommandLinkRel, CommandResource } from '@alfa-client/command-shared'; import { StateResource, createStateResource } from '@alfa-client/tech-shared'; import { Mock, mock, useFromMock } from '@alfa-client/test-utils'; import { UntypedFormBuilder } from '@angular/forms'; @@ -44,7 +44,9 @@ describe('CollaborationRequestFormService', () => { }); describe('do submit', () => { - const stateCommandResource: StateResource<CommandResource> = createStateResource(createCommandResource()); + const stateCommandResource: StateResource<CommandResource> = createStateResource( + createCommandResource([CommandLinkRel.EFFECTED_RESOURCE]), + ); beforeEach(() => { formService.listResource = collaborationListResource; @@ -57,6 +59,12 @@ describe('CollaborationRequestFormService', () => { expect(service.create).toHaveBeenCalledWith(collaborationListResource, formService.form.value); }); + it('should call service refresh', () => { + formService.submit().subscribe(); + + expect(service.refreshList).toHaveBeenCalled(); + }); + it('should return stateCommandResource', () => { const response$: Observable<StateResource<CommandResource>> = formService.submit(); diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-request-form/collaboration.request.formservice.ts b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-request-form/collaboration.request.formservice.ts index 3e9334240e76bc7a2fff71ea1f4d22b10f9d253d..0b3f33a899156e8af47cd1a7db35abe9a255a38e 100644 --- a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-request-form/collaboration.request.formservice.ts +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/collaboration-request-form/collaboration.request.formservice.ts @@ -1,5 +1,5 @@ import { CollaborationListResource } from '@alfa-client/collaboration-shared'; -import { CommandResource } from '@alfa-client/command-shared'; +import { CommandResource, tapOnCommandSuccessfullyDone } from '@alfa-client/command-shared'; import { AbstractFormService, StateResource } from '@alfa-client/tech-shared'; import { Injectable } from '@angular/core'; import { FormBuilder, FormControl, FormGroup } from '@angular/forms'; @@ -33,7 +33,9 @@ export class CollaborationRequestFormService extends AbstractFormService<Command } protected doSubmit(): Observable<StateResource<CommandResource>> { - return this.service.create(this.listResource, this.getFormValue()); + return this.service + .create(this.listResource, this.getFormValue()) + .pipe(tapOnCommandSuccessfullyDone(() => this.service.refreshList())); } protected getPathPrefix(): string {