@@ -8,21 +8,21 @@ import test from 'tape'
8
8
import remark from 'remark'
9
9
import { findBefore } from './index.js'
10
10
11
- test ( 'unist-util-find-before' , function ( t ) {
11
+ test ( 'unist-util-find-before' , ( t ) => {
12
12
/** @type {Root } */
13
13
// @ts -expect-error: fine.
14
- var tree = remark ( ) . parse ( 'Some *emphasis*, **importance**, and `code`.' )
14
+ const tree = remark ( ) . parse ( 'Some *emphasis*, **importance**, and `code`.' )
15
15
16
16
assert ( tree . type === 'root' )
17
- var paragraph = tree . children [ 0 ]
17
+ const paragraph = tree . children [ 0 ]
18
18
assert ( paragraph . type === 'paragraph' )
19
- var head = paragraph . children [ 0 ]
19
+ const head = paragraph . children [ 0 ]
20
20
assert ( head . type === 'text' )
21
- var next = paragraph . children [ 1 ]
21
+ const next = paragraph . children [ 1 ]
22
22
assert ( next . type === 'emphasis' )
23
23
24
24
t . throws (
25
- function ( ) {
25
+ ( ) => {
26
26
// @ts -ignore runtime
27
27
findBefore ( )
28
28
} ,
@@ -31,7 +31,7 @@ test('unist-util-find-before', function (t) {
31
31
)
32
32
33
33
t . throws (
34
- function ( ) {
34
+ ( ) => {
35
35
// @ts -ignore runtime
36
36
findBefore ( { type : 'foo' } )
37
37
} ,
@@ -40,7 +40,7 @@ test('unist-util-find-before', function (t) {
40
40
)
41
41
42
42
t . throws (
43
- function ( ) {
43
+ ( ) => {
44
44
// @ts -ignore runtime
45
45
findBefore ( { type : 'foo' , children : [ ] } )
46
46
} ,
@@ -49,23 +49,23 @@ test('unist-util-find-before', function (t) {
49
49
)
50
50
51
51
t . throws (
52
- function ( ) {
52
+ ( ) => {
53
53
findBefore ( { type : 'foo' , children : [ ] } , - 1 )
54
54
} ,
55
55
/ E x p e c t e d p o s i t i v e f i n i t e n u m b e r a s i n d e x / ,
56
56
'should fail without index (#2)'
57
57
)
58
58
59
59
t . throws (
60
- function ( ) {
60
+ ( ) => {
61
61
findBefore ( { type : 'foo' , children : [ ] } , { type : 'bar' } )
62
62
} ,
63
63
/ E x p e c t e d c h i l d n o d e o r i n d e x / ,
64
64
'should fail without index (#3)'
65
65
)
66
66
67
67
t . throws (
68
- function ( ) {
68
+ ( ) => {
69
69
// @ts -ignore runtime
70
70
findBefore ( { type : 'foo' , children : [ { type : 'bar' } ] } , 1 , false )
71
71
} ,
@@ -74,7 +74,7 @@ test('unist-util-find-before', function (t) {
74
74
)
75
75
76
76
t . throws (
77
- function ( ) {
77
+ ( ) => {
78
78
// @ts -ignore runtime
79
79
findBefore ( { type : 'foo' , children : [ { type : 'bar' } ] } , 1 , true )
80
80
} ,
0 commit comments