Merge branch 'master' into w2p-62589_Item-mapper-update

Conflicts:
	resources/i18n/en.json
	src/app/+search-page/search-service/search.service.ts
	src/app/core/core.module.ts
This commit is contained in:
Kristof De Langhe
2019-08-12 15:23:43 +02:00
476 changed files with 6780 additions and 5048 deletions

View File

@@ -18,6 +18,10 @@ import {
import { RemoteData } from '../data/remote-data';
import { RemoteDataError } from '../data/remote-data-error';
import { of as observableOf } from 'rxjs';
import {
createFailedRemoteDataObject,
createSuccessfulRemoteDataObject
} from '../../shared/testing/utils';
describe('Core Module - RxJS Operators', () => {
let scheduler: TestScheduler;
@@ -180,17 +184,17 @@ describe('Core Module - RxJS Operators', () => {
describe('getSucceededRemoteData', () => {
it('should return the first() hasSucceeded RemoteData Observable', () => {
const testRD = {
a: new RemoteData(false, false, true, null, undefined),
b: new RemoteData(false, false, false, null, 'b'),
a: createSuccessfulRemoteDataObject(undefined),
b: createFailedRemoteDataObject( 'b'),
c: new RemoteData(false, false, undefined, null, 'c'),
d: new RemoteData(false, false, true, null, 'd'),
e: new RemoteData(false, false, true, null, 'e'),
d: createSuccessfulRemoteDataObject('d'),
e: createSuccessfulRemoteDataObject('e'),
};
const source = hot('abcde', testRD);
const result = source.pipe(getSucceededRemoteData());
result.subscribe((value) => expect(value)
.toEqual(new RemoteData(false, false, true, null, 'd')));
.toEqual(createSuccessfulRemoteDataObject('d')));
});
});
@@ -202,21 +206,21 @@ describe('Core Module - RxJS Operators', () => {
});
it('should call navigateByUrl to a 404 page, when the remote data contains a 404 error', () => {
const testRD = new RemoteData(false, false, false, new RemoteDataError(404, 'Not Found', 'Object was not found'), undefined);
const testRD = createFailedRemoteDataObject(undefined, new RemoteDataError(404, 'Not Found', 'Object was not found'));
observableOf(testRD).pipe(redirectToPageNotFoundOn404(router)).subscribe();
expect(router.navigateByUrl).toHaveBeenCalledWith('/404', { skipLocationChange: true });
});
it('should not call navigateByUrl to a 404 page, when the remote data contains another error than a 404', () => {
const testRD = new RemoteData(false, false, false, new RemoteDataError(500, 'Server Error', 'Something went wrong'), undefined);
const testRD = createFailedRemoteDataObject(undefined, new RemoteDataError(500, 'Server Error', 'Something went wrong'));
observableOf(testRD).pipe(redirectToPageNotFoundOn404(router)).subscribe();
expect(router.navigateByUrl).not.toHaveBeenCalled();
});
it('should not call navigateByUrl to a 404 page, when the remote data contains no error', () => {
const testRD = new RemoteData(false, false, true, null, undefined);
const testRD = createSuccessfulRemoteDataObject(undefined);
observableOf(testRD).pipe(redirectToPageNotFoundOn404(router)).subscribe();
expect(router.navigateByUrl).not.toHaveBeenCalled();
@@ -242,11 +246,11 @@ describe('Core Module - RxJS Operators', () => {
describe('getAllSucceededRemoteData', () => {
it('should return all hasSucceeded RemoteData Observables', () => {
const testRD = {
a: new RemoteData(false, false, true, null, undefined),
b: new RemoteData(false, false, false, null, 'b'),
a: createSuccessfulRemoteDataObject(undefined),
b: createFailedRemoteDataObject('b'),
c: new RemoteData(false, false, undefined, null, 'c'),
d: new RemoteData(false, false, true, null, 'd'),
e: new RemoteData(false, false, true, null, 'e'),
d: createSuccessfulRemoteDataObject('d'),
e: createSuccessfulRemoteDataObject('e'),
};
const source = hot('abcde', testRD);
const result = source.pipe(getAllSucceededRemoteData());