Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

93 lines
2.0 KiB

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { allData, allParams } from './router-utils';
describe('RouterUtils', () => {
it('should concat all params from route', () => {
const snapshot = {
params: {
key1: 'key1',
},
parent: {
params: {
key1: 'key1-parent',
key2: 'key2',
},
},
};
const params = allParams(<any>{ snapshot });
expect(params).toEqual({
key1: 'key1',
key2: 'key2',
});
});
it('should concat all params from snapshot', () => {
const snapshot = {
params: {
key1: 'key1',
},
parent: {
params: {
key1: 'key1-parent',
key2: 'key2',
},
},
};
const params = allParams(<any>snapshot);
expect(params).toEqual({
key1: 'key1',
key2: 'key2',
});
});
it('should concat all data from route', () => {
const snapshot = {
data: {
key1: 'key1',
},
parent: {
data: {
key1: 'key1-parent',
key2: 'key2',
},
},
};
const params = allData(<any>{ snapshot });
expect(params).toEqual({
key1: 'key1',
key2: 'key2',
});
});
it('should concat all data from snapshot', () => {
const snapshot = {
data: {
key1: 'key1',
},
parent: {
data: {
key1: 'key1-parent',
key2: 'key2',
},
},
};
const params = allData(<any>snapshot);
expect(params).toEqual({
key1: 'key1',
key2: 'key2',
});
});
});