tiptap/tests/cypress/integration/core/mergeDeep.spec.ts
Philipp Kühn e07a5b625d
refactor: Use named exports instead of default exports (#2238)
* use named exports instead of default exports

* fix tests

Co-authored-by: Philipp Kühn <philippkuehn@MacBook-Pro-von-Philipp.local>
2021-12-06 12:00:09 +01:00

69 lines
1.0 KiB
TypeScript

/// <reference types="cypress" />
import { mergeDeep } from '@tiptap/core/src/utilities/mergeDeep'
describe('mergeDeep', () => {
it('should merge', () => {
const one = {
a: 1,
}
const two = {
b: 1,
}
const result = {
a: 1,
b: 1,
}
const merged = mergeDeep(one, two)
expect(merged).to.deep.eq(result)
})
it('should not merge array', () => {
const one = {
a: [1],
}
const two = {
a: [2],
}
const result = {
a: [2],
}
const merged = mergeDeep(one, two)
expect(merged).to.deep.eq(result)
})
it('should merge deep', () => {
const one = {
a: 1,
b: {
c: true,
},
d: {
e: true,
f: [1],
},
}
const two = {
b: 1,
d: {
f: [2],
g: 1,
},
}
const result = {
a: 1,
b: 1,
d: {
e: true,
f: [2],
g: 1,
},
}
const merged = mergeDeep(one, two)
expect(merged).to.deep.eq(result)
})
})