|
1 |
| -'use strict'; |
| 1 | +'use strict' |
2 | 2 |
|
3 |
| -var test = require('tape'); |
4 |
| -var position = require('.'); |
| 3 | +var test = require('tape') |
| 4 | +var position = require('.') |
5 | 5 |
|
6 | 6 | var properties = {
|
7 | 7 | position: {
|
8 | 8 | start: {line: 1, column: 1, offset: 0},
|
9 | 9 | end: {line: 1, column: 2, offset: 1}
|
10 | 10 | }
|
11 |
| -}; |
| 11 | +} |
12 | 12 |
|
13 | 13 | var objects = {
|
14 | 14 | position: {start: {}, end: {}}
|
15 |
| -}; |
| 15 | +} |
16 | 16 |
|
17 |
| -var values = {position: {}}; |
| 17 | +var values = {position: {}} |
18 | 18 |
|
19 |
| -var none = {}; |
| 19 | +var none = {} |
20 | 20 |
|
21 |
| -var generated = {line: null, column: null, offset: null}; |
| 21 | +var generated = {line: null, column: null, offset: null} |
22 | 22 |
|
23 |
| -test('unist-util-position', function (t) { |
24 |
| - ['start', 'end'].forEach(function (type) { |
25 |
| - t.test(type, function (st) { |
26 |
| - var fn = position[type]; |
| 23 | +test('unist-util-position', function(t) { |
| 24 | + ;['start', 'end'].forEach(function(type) { |
| 25 | + t.test(type, function(st) { |
| 26 | + var fn = position[type] |
27 | 27 |
|
28 |
| - st.same( |
29 |
| - fn(), |
30 |
| - generated, |
31 |
| - 'should not throw without node' |
32 |
| - ); |
| 28 | + st.same(fn(), generated, 'should not throw without node') |
33 | 29 |
|
34 |
| - st.same( |
35 |
| - fn(properties), |
36 |
| - properties.position[type], |
37 |
| - 'should get type' |
38 |
| - ); |
| 30 | + st.same(fn(properties), properties.position[type], 'should get type') |
39 | 31 |
|
40 | 32 | st.same(
|
41 | 33 | fn(objects),
|
42 | 34 | generated,
|
43 | 35 | 'should return an empty object without objects'
|
44 |
| - ); |
| 36 | + ) |
45 | 37 |
|
46 | 38 | st.same(
|
47 | 39 | fn(values),
|
48 | 40 | generated,
|
49 | 41 | 'should return an empty object without values'
|
50 |
| - ); |
| 42 | + ) |
51 | 43 |
|
52 | 44 | st.same(
|
53 | 45 | fn(none),
|
54 | 46 | generated,
|
55 | 47 | 'should return an empty object without position'
|
56 |
| - ); |
| 48 | + ) |
57 | 49 |
|
58 |
| - st.end(); |
59 |
| - }); |
60 |
| - }); |
| 50 | + st.end() |
| 51 | + }) |
| 52 | + }) |
61 | 53 |
|
62 |
| - t.end(); |
63 |
| -}); |
| 54 | + t.end() |
| 55 | +}) |
0 commit comments