Dispaly an error notification when an error occured on submission save

This commit is contained in:
Giuseppe Digilio
2019-02-28 18:39:12 +01:00
parent ce06b1af2a
commit 167c50e9a3
5 changed files with 47 additions and 5 deletions

View File

@@ -23,6 +23,7 @@ import {
} from './json-patch-operations.actions';
import { MockStore } from '../../shared/testing/mock-store';
import { RequestEntry } from '../data/request.reducer';
import { catchError } from 'rxjs/operators';
class TestService extends JsonPatchOperationsService<SubmitDataResponseDefinitionObject, SubmissionPatchRequest> {
protected linkPath = '';
@@ -176,7 +177,9 @@ describe('JsonPatchOperationsService test suite', () => {
it('should dispatch a new RollbacktPatchOperationsAction', () => {
const expectedAction = new RollbacktPatchOperationsAction(testJsonPatchResourceType, undefined);
scheduler.schedule(() => service.jsonPatchByResourceType(resourceEndpoint, resourceScope, testJsonPatchResourceType).subscribe());
scheduler.schedule(() => service.jsonPatchByResourceType(resourceEndpoint, resourceScope, testJsonPatchResourceType)
.pipe(catchError(() => observableOf({})))
.subscribe());
scheduler.flush();
expect(store.dispatch).toHaveBeenCalledWith(expectedAction);
@@ -237,7 +240,9 @@ describe('JsonPatchOperationsService test suite', () => {
it('should dispatch a new RollbacktPatchOperationsAction', () => {
const expectedAction = new RollbacktPatchOperationsAction(testJsonPatchResourceType, testJsonPatchResourceId);
scheduler.schedule(() => service.jsonPatchByResourceID(resourceEndpoint, resourceScope, testJsonPatchResourceType, testJsonPatchResourceId).subscribe());
scheduler.schedule(() => service.jsonPatchByResourceID(resourceEndpoint, resourceScope, testJsonPatchResourceType, testJsonPatchResourceId)
.pipe(catchError(() => observableOf({})))
.subscribe());
scheduler.flush();
expect(store.dispatch).toHaveBeenCalledWith(expectedAction);