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

OZG-6477 7189 refresh after successfull

parent 158917f4
No related branches found
No related tags found
No related merge requests found
......@@ -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) => {
......
......@@ -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();
}
......
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();
......
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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment