forked from Tabloids/wdclib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Utilities.test.js
46 lines (31 loc) · 973 Bytes
/
Utilities.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* eslint-env node, mocha, jest */
import { copyFunctions, linkObjectProperties } from './Utilities';
describe('UNIT - Utilities', () => {
it('copyFunctions to copy functions from source to target', () => {
let source = {
a: function a () {
}
};
let target = {};
copyFunctions(source, target);
expect(target.a).toBe(source.a);
});
it('linkObjectProperties to change the values from target to source', () => {
let source = {
a: function a () {
},
x: 5,
y: 'this is why'
};
let target = {
y: 'there\'no why'
};
linkObjectProperties(source, target, ['x', 'y']);
expect(target.x).toBe(source.x);
expect(target.y).toBe(source.y);
let y = 'I wonder why';
target.y = y;
expect(target.y).toBe(source.y);
expect(target.y).toBe(y);
});
});