|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 |
| -/* eslint-env mocha */ |
| 3 | +/* eslint-env node */ |
4 | 4 |
|
5 | 5 | /*
|
6 | 6 | * Dependencies.
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -var assert = require('assert'); |
| 9 | +var test = require('tape'); |
10 | 10 | var position = require('./index.js');
|
11 | 11 |
|
12 |
| -/* |
13 |
| - * Methods. |
14 |
| - */ |
15 |
| - |
16 |
| -var dequal = assert.deepEqual; |
17 |
| - |
18 | 12 | /*
|
19 | 13 | * Fixture.
|
20 | 14 | */
|
@@ -60,52 +54,78 @@ var pos = {
|
60 | 54 | * Tests.
|
61 | 55 | */
|
62 | 56 |
|
63 |
| -describe('mdast-util-position', function () { |
| 57 | +test('mdast-util-position', function (t) { |
64 | 58 | ['start', 'end'].forEach(function (type) {
|
65 |
| - describe(type, function () { |
| 59 | + t.test(type, function (st) { |
66 | 60 | var fn = position[type];
|
67 | 61 |
|
68 |
| - it('should not throw without node', function () { |
69 |
| - dequal(fn(), pos); |
70 |
| - }); |
71 |
| - |
72 |
| - it('should get type', function () { |
73 |
| - dequal(fn(properties), properties.position[type]); |
74 |
| - }); |
75 |
| - |
76 |
| - it('should return an empty object without objects', function () { |
77 |
| - dequal(fn(objects), pos); |
78 |
| - }); |
79 |
| - |
80 |
| - it('should return an empty object without values', function () { |
81 |
| - dequal(fn(values), pos); |
82 |
| - }); |
83 |
| - |
84 |
| - it('should return an empty object without position', function () { |
85 |
| - dequal(fn(none), pos); |
86 |
| - }); |
| 62 | + st.same( |
| 63 | + fn(), |
| 64 | + pos, |
| 65 | + 'should not throw without node' |
| 66 | + ); |
| 67 | + |
| 68 | + st.same( |
| 69 | + fn(properties), |
| 70 | + properties.position[type], |
| 71 | + 'should get type' |
| 72 | + ); |
| 73 | + |
| 74 | + st.same( |
| 75 | + fn(objects), |
| 76 | + pos, |
| 77 | + 'should return an empty object without objects' |
| 78 | + ); |
| 79 | + |
| 80 | + st.same( |
| 81 | + fn(values), |
| 82 | + pos, |
| 83 | + 'should return an empty object without values' |
| 84 | + ); |
| 85 | + |
| 86 | + st.same( |
| 87 | + fn(none), |
| 88 | + pos, |
| 89 | + 'should return an empty object without position' |
| 90 | + ); |
| 91 | + |
| 92 | + st.end(); |
87 | 93 | });
|
88 | 94 | });
|
89 | 95 |
|
90 |
| - describe('generated', function () { |
91 |
| - it('should not throw without node', function () { |
92 |
| - assert.equal(position.generated(), true); |
93 |
| - }); |
94 |
| - |
95 |
| - it('should return false when with properties', function () { |
96 |
| - assert.equal(position.generated(properties), false); |
97 |
| - }); |
98 |
| - |
99 |
| - it('should return false when without properties', function () { |
100 |
| - assert.equal(position.generated(objects), true); |
101 |
| - }); |
102 |
| - |
103 |
| - it('should return false when without objects', function () { |
104 |
| - assert.equal(position.generated(values), true); |
105 |
| - }); |
106 |
| - |
107 |
| - it('should return false when without position', function () { |
108 |
| - assert.equal(position.generated(none), true); |
109 |
| - }); |
110 |
| - }); |
| 96 | + t.test('generated', function (st) { |
| 97 | + st.equal( |
| 98 | + position.generated(), |
| 99 | + true, |
| 100 | + 'should not throw without node' |
| 101 | + ); |
| 102 | + |
| 103 | + st.equal( |
| 104 | + position.generated(properties), |
| 105 | + false, |
| 106 | + 'should return false when with properties' |
| 107 | + ); |
| 108 | + |
| 109 | + st.equal( |
| 110 | + position.generated(objects), |
| 111 | + true, |
| 112 | + 'should return true when without properties' |
| 113 | + ); |
| 114 | + |
| 115 | + st.equal( |
| 116 | + position.generated(values), |
| 117 | + true, |
| 118 | + 'should return true when without objects' |
| 119 | + ); |
| 120 | + |
| 121 | + st.equal( |
| 122 | + position.generated(none), |
| 123 | + true, |
| 124 | + 'should return true when without position' |
| 125 | + ); |
| 126 | + |
| 127 | + st.end(); |
| 128 | + }) |
| 129 | + |
| 130 | + t.end(); |
111 | 131 | });
|
0 commit comments