@@ -30,15 +30,29 @@ test('unist-util-find-all-after', function(t) {
30
30
assert . throws ( function ( ) {
31
31
findAllAfter ( { type : 'foo' , children : [ ] } )
32
32
} , / E x p e c t e d p o s i t i v e f i n i t e i n d e x o r c h i l d n o d e / )
33
+ } , 'should fail without index' )
33
34
35
+ t . doesNotThrow ( function ( ) {
34
36
assert . throws ( function ( ) {
35
37
findAllAfter ( { type : 'foo' , children : [ ] } , - 1 )
36
- } , / E x p e c t e d p o s i t i v e f i n i t e i n d e x o r c h i l d n o d e / )
38
+ } , / 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 / )
39
+
40
+ assert . throws ( function ( ) {
41
+ findAllAfter ( { type : 'foo' , children : [ ] } , Infinity )
42
+ } , / 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 / )
43
+
44
+ assert . throws ( function ( ) {
45
+ findAllAfter ( { type : 'foo' , children : [ ] } , false )
46
+ } , / 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 / )
47
+
48
+ assert . throws ( function ( ) {
49
+ findAllAfter ( { type : 'foo' , children : [ ] } , '' )
50
+ } , / 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 / )
37
51
38
52
assert . throws ( function ( ) {
39
53
findAllAfter ( { type : 'foo' , children : [ ] } , { type : 'bar' } )
40
- } , / E x p e c t e d p o s i t i v e f i n i t e i n d e x o r c h i l d n o d e / )
41
- } , 'should fail without index' )
54
+ } , / E x p e c t e d c h i l d n o d e / )
55
+ } , 'should fail with invalid index' )
42
56
43
57
t . doesNotThrow ( function ( ) {
44
58
assert . throws ( function ( ) {
0 commit comments