UNPKG

1.05 kBPlain TextView Raw
1import deref from './deref';
2
3describe('deref', () => {
4 test('derefs a ref layer which follows its parent', () => {
5 expect(deref([
6 {
7 'id': 'parent',
8 'type': 'line'
9 },
10 {
11 'id': 'child',
12 'ref': 'parent'
13 }
14 ])).toEqual([
15 {
16 'id': 'parent',
17 'type': 'line'
18 },
19 {
20 'id': 'child',
21 'type': 'line'
22 }
23 ]);
24 });
25
26 test('derefs a ref layer which precedes its parent', () => {
27 expect(deref([
28 {
29 'id': 'child',
30 'ref': 'parent'
31 },
32 {
33 'id': 'parent',
34 'type': 'line'
35 }
36 ])).toEqual([
37 {
38 'id': 'child',
39 'type': 'line'
40 },
41 {
42 'id': 'parent',
43 'type': 'line'
44 }
45 ]);
46 });
47});