@@ -40,18 +40,16 @@ describe('unexpected-check', function () {
40
40
. and ( 'last item to be greater than or equal to all' , arr ) ;
41
41
} , 'to be valid for all' , arrays ) ;
42
42
} , 'to throw' ,
43
- 'Ran 23 iterations and found 20 errors\n' +
43
+ 'Ran 44 iterations and found 20 errors\n' +
44
44
'counterexample:\n' +
45
45
'\n' +
46
- ' Generated input: [ -19, -2, -16 ]\n' +
46
+ ' Generated input: [ 18, 4 ]\n' +
47
47
'\n' +
48
- ' expected [ -16, -19, -2 ]\n' +
49
- ' first item to be less than or equal to all [ -19, -2, -16 ]\n' +
48
+ ' expected [ 18, 4 ] first item to be less than or equal to all [ 18, 4 ]\n' +
50
49
'\n' +
51
50
' [\n' +
52
- ' -19, // should be greater than or equal to -16\n' +
53
- ' -2,\n' +
54
- ' -16\n' +
51
+ ' 18,\n' +
52
+ ' 4 // should be greater than or equal to 18\n' +
55
53
' ]' ) ;
56
54
} ) ;
57
55
@@ -61,19 +59,15 @@ describe('unexpected-check', function () {
61
59
expect ( arr , 'not to contain' , 2 ) ;
62
60
} , 'to be valid for all' , arrays ) ;
63
61
} , 'to throw' ,
64
- 'Ran 52 iterations and found 20 errors\n' +
62
+ 'Ran 25 iterations and found 20 errors\n' +
65
63
'counterexample:\n' +
66
64
'\n' +
67
- ' Generated input: [ 2, -17, 9, -13, 7 ]\n' +
65
+ ' Generated input: [ 2 ]\n' +
68
66
'\n' +
69
- ' expected [ 2, -17, 9, -13, 7 ] not to contain 2\n' +
67
+ ' expected [ 2 ] not to contain 2\n' +
70
68
'\n' +
71
69
' [\n' +
72
- ' 2, // should be removed\n' +
73
- ' -17,\n' +
74
- ' 9,\n' +
75
- ' -13,\n' +
76
- ' 7\n' +
70
+ ' 2 // should be removed\n' +
77
71
' ]' ) ;
78
72
} ) ;
79
73
@@ -93,15 +87,37 @@ describe('unexpected-check', function () {
93
87
expect ( items , 'not to contain' , i ) ;
94
88
} , 'to be valid for all' , arrays , g . integer ( { min : - 20 , max : 20 } ) ) ;
95
89
} , 'to throw' ,
96
- 'Ran 96 iterations and found 20 errors\n' +
90
+ 'Ran 100 iterations and found 18 errors\n' +
97
91
'counterexample:\n' +
98
92
'\n' +
99
- ' Generated input: [ -7 ], -7 \n' +
93
+ ' Generated input: [ 3 ], 3 \n' +
100
94
'\n' +
101
- ' expected [ -7 ] not to contain -7 \n' +
95
+ ' expected [ 3 ] not to contain 3 \n' +
102
96
'\n' +
103
97
' [\n' +
104
- ' -7 // should be removed\n' +
98
+ ' 3 // should be removed\n' +
99
+ ' ]' ) ;
100
+ } ) ;
101
+
102
+ it ( 'finds needle in a haystack errors' , function ( ) {
103
+ expect ( function ( ) {
104
+ expect ( function ( items ) {
105
+ expect ( items , 'to have items satisfying' , function ( item , i ) {
106
+ expect ( item , 'not to be' , i ) ;
107
+ } ) ;
108
+ } , 'to be valid for all' , arrays ) ;
109
+ } , 'to throw' ,
110
+ 'Ran 100 iterations and found 17 errors\n' +
111
+ 'counterexample:\n' +
112
+ '\n' +
113
+ ' Generated input: [ -19, 1 ]\n' +
114
+ '\n' +
115
+ ' expected [ -19, 1 ]\n' +
116
+ ' to have items satisfying function (item, i) { expect(item, \'not to be\', i); }\n' +
117
+ '\n' +
118
+ ' [\n' +
119
+ ' -19,\n' +
120
+ ' 1 // should not be 1\n' +
105
121
' ]' ) ;
106
122
} ) ;
107
123
} ) ;
0 commit comments