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 remark = require ( 'remark' ) ;
11
11
var definitions = require ( './index.js' ) ;
12
12
13
13
/*
14
14
* Tests.
15
15
*/
16
16
17
- describe ( 'mdast-util-definitions' , function ( ) {
18
- it ( 'should fail without node' , function ( ) {
19
- assert . throws ( function ( ) {
17
+ test ( 'mdast-util-definitions' , function ( t ) {
18
+ var getDefinition ;
19
+ var ast ;
20
+
21
+ t . throws (
22
+ function ( ) {
20
23
definitions ( ) ;
21
- } , / m d a s t - u t i l - d e f i n i t i o n s e x p e c t e d n o d e / ) ;
22
- } ) ;
24
+ } ,
25
+ / m d a s t - u t i l - d e f i n i t i o n s e x p e c t e d n o d e / ,
26
+ 'should fail without node'
27
+ ) ;
23
28
24
- it ( 'should work' , function ( ) {
25
- var ast = remark . parse ( '[example]: http://example.com "Example"' ) ;
26
- var getDefinition = definitions ( ast ) ;
29
+ ast = remark . parse ( '[example]: http://example.com "Example"' ) ;
30
+ getDefinition = definitions ( ast ) ;
27
31
28
- assert . deepEqual ( getDefinition ( 'example' ) , {
32
+ t . deepEqual (
33
+ getDefinition ( 'example' ) ,
34
+ {
29
35
'type' : 'definition' ,
30
36
'identifier' : 'example' ,
31
37
'link' : 'http://example.com' ,
@@ -41,16 +47,22 @@ describe('mdast-util-definitions', function () {
41
47
} ,
42
48
'indent' : [ ]
43
49
}
44
- } ) ;
50
+ } ,
51
+ 'should return a definition'
52
+ ) ;
45
53
46
- assert . deepEqual ( getDefinition ( 'foo' ) , null ) ;
47
- } ) ;
54
+ t . equal (
55
+ getDefinition ( 'foo' ) ,
56
+ null ,
57
+ 'should return null when not found'
58
+ ) ;
48
59
49
- it ( 'should work on weird identifiers' , function ( ) {
50
- var ast = remark . parse ( '[__proto__]: http://proto.com "Proto"' ) ;
51
- var getDefinition = definitions ( ast ) ;
60
+ ast = remark . parse ( '[__proto__]: http://proto.com "Proto"' ) ;
61
+ getDefinition = definitions ( ast ) ;
52
62
53
- assert . deepEqual ( getDefinition ( '__proto__' ) , {
63
+ t . deepEqual (
64
+ getDefinition ( '__proto__' ) ,
65
+ {
54
66
'type' : 'definition' ,
55
67
'identifier' : '__proto__' ,
56
68
'link' : 'http://proto.com' ,
@@ -66,8 +78,15 @@ describe('mdast-util-definitions', function () {
66
78
} ,
67
79
'indent' : [ ]
68
80
}
69
- } ) ;
81
+ } ,
82
+ 'should work on weird identifiers'
83
+ ) ;
84
+
85
+ t . deepEqual (
86
+ getDefinition ( 'toString' ) ,
87
+ null ,
88
+ 'should work on weird identifiers when not found'
89
+ ) ;
70
90
71
- assert . deepEqual ( getDefinition ( 'toString' ) , null ) ;
72
- } ) ;
91
+ t . end ( ) ;
73
92
} ) ;
0 commit comments