moy-fp
Version:
A functional programming library.
24 lines (20 loc) • 528 B
JavaScript
import __ from '../../src/Function/__'
/**
* {k: v} -> {k: v} -> {k: v}
*/
import merge from '../../src/Object/merge'
test('merge(not using __), has no the same key', () => {
expect(
merge({a: 1, b: 2})({c: 3})
).toEqual({a: 1, b: 2, c: 3})
})
test('merge(not using __), has the same key', () => {
expect(
merge({a: 1, b: 2})({a: 4, c: 3})
).toEqual({a: 4, b: 2, c: 3})
})
test('merge(using __), has no the same key', () => {
expect(
merge(__, {c: 3})({a: 1, b: 2})
).toEqual({a: 1, b: 2, c: 3})
})