@@ -125,13 +125,16 @@ describe('expect()', () => {
125
125
it ( 'asserts on invalid condition (large array, display truncated)' , ( done ) => {
126
126
127
127
let exception = false ;
128
+ const origTruncate = Code . settings . truncateMessages ;
128
129
try {
130
+ Code . settings . truncateMessages = true ;
129
131
Code . expect ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 ] ) . to . be . a . string ( ) ;
130
132
}
131
133
catch ( err ) {
132
134
exception = err ;
133
135
}
134
136
137
+ Code . settings . truncateMessages = origTruncate ;
135
138
Hoek . assert ( exception . message === 'Expected [Array(18)] to be a string but got \'array\'' , exception ) ;
136
139
done ( ) ;
137
140
} ) ;
@@ -156,13 +159,16 @@ describe('expect()', () => {
156
159
it ( 'asserts on invalid condition (large object, display truncated)' , ( done ) => {
157
160
158
161
let exception = false ;
162
+ const origTruncate = Code . settings . truncateMessages ;
159
163
try {
164
+ Code . settings . truncateMessages = true ;
160
165
Code . expect ( { a : 1 , b : 2 , c : 3 , d : 4 , e : 5 , f : 6 , g : 7 , h : 8 , i : 9 , j : 10 } ) . to . be . a . string ( ) ;
161
166
}
162
167
catch ( err ) {
163
168
exception = err ;
164
169
}
165
170
171
+ Code . settings . truncateMessages = origTruncate ;
166
172
Hoek . assert ( exception . message === 'Expected { Object (a, b, ...) } to be a string but got \'object\'' , exception ) ;
167
173
done ( ) ;
168
174
} ) ;
@@ -204,13 +210,16 @@ describe('expect()', () => {
204
210
it ( 'asserts on invalid condition (long object values, display truncated)' , ( done ) => {
205
211
206
212
let exception = false ;
213
+ const origTruncate = Code . settings . truncateMessages ;
207
214
try {
215
+ Code . settings . truncateMessages = true ;
208
216
Code . expect ( { a : 12345678901234567890 , b : 12345678901234567890 } ) . to . be . a . string ( ) ;
209
217
}
210
218
catch ( err ) {
211
219
exception = err ;
212
220
}
213
221
222
+ Code . settings . truncateMessages = origTruncate ;
214
223
Hoek . assert ( exception . message === 'Expected { Object (a, b) } to be a string but got \'object\'' , exception ) ;
215
224
done ( ) ;
216
225
} ) ;
@@ -235,13 +244,16 @@ describe('expect()', () => {
235
244
it ( 'asserts on invalid condition (long string, display truncated)' , ( done ) => {
236
245
237
246
let exception = false ;
247
+ const origTruncate = Code . settings . truncateMessages ;
238
248
try {
249
+ Code . settings . truncateMessages = true ;
239
250
Code . expect ( '{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10 }' ) . to . be . a . number ( ) ;
240
251
}
241
252
catch ( err ) {
242
253
exception = err ;
243
254
}
244
255
256
+ Code . settings . truncateMessages = origTruncate ;
245
257
Hoek . assert ( exception . message === 'Expected \'{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g...\' to be a number but got \'string\'' , exception ) ;
246
258
done ( ) ;
247
259
} ) ;
0 commit comments