Browse Source

Tests for merging.

pull/414/head
Sebastian 7 years ago
parent
commit
4ab0048115
  1. 35
      src/Squidex/app/framework/utils/types.spec.ts

35
src/Squidex/app/framework/utils/types.spec.ts

@ -5,7 +5,7 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { Types } from './types';
import { mergeInto, Types } from './types';
describe('Types', () => {
it('should calculate hash string', () => {
@ -152,6 +152,39 @@ describe('Types', () => {
it('should treat object of empty values as empty', () => {
expect(Types.isEmpty({ a: null, b: null })).toBeTruthy();
});
it('should merge deeply', () => {
const source = {};
mergeInto(source, {
rootShared: 1,
rootA: 2,
nested: {
a: 3
},
array: [4]
});
mergeInto(source, {
rootShared: 5,
rootB: 6,
nested: {
b: 7
},
array: [8]
});
expect(source).toEqual({
rootShared: 5,
rootA: 2,
rootB: 6,
nested: {
a: 3,
b: 7
},
array: [4, 8]
});
});
});
class MyClass {

Loading…
Cancel
Save