@@ -667,14 +667,15 @@ describe('expect()', () => {
667
667
exception = err ;
668
668
}
669
669
670
- Hoek . assert ( exception . message === ' Expected {} to be an error with Error type' , exception ) ;
670
+ Hoek . assert ( / E x p e c t e d ( C u s t o m ) ? { } t o b e a n e r r o r w i t h E r r o r t y p e / . test ( exception . message ) , exception ) ;
671
671
done ( ) ;
672
672
} ) ;
673
673
674
674
it ( 'invalidates assertion (anonymous type)' , ( done ) => {
675
675
676
676
const Custom = function ( ) { } ;
677
677
Hoek . inherits ( Custom , Error ) ;
678
+ delete Custom . name ; // Ensure that the type is anonymous
678
679
679
680
let exception = false ;
680
681
try {
@@ -1938,6 +1939,7 @@ describe('expect()', () => {
1938
1939
it ( 'invalidates assertion (anonymous)' , ( done ) => {
1939
1940
1940
1941
const Custom = function ( ) { } ;
1942
+ delete Custom . name ; // Ensure that the type is anonymous
1941
1943
1942
1944
let exception = false ;
1943
1945
try {
@@ -2257,6 +2259,7 @@ describe('expect()', () => {
2257
2259
it ( 'invalidates assertion (anonymous type)' , ( done ) => {
2258
2260
2259
2261
const Custom = function ( ) { } ;
2262
+ delete Custom . name ; // Ensure that the type is anonymous
2260
2263
2261
2264
let exception = false ;
2262
2265
try {
@@ -2266,7 +2269,7 @@ describe('expect()', () => {
2266
2269
exception = err ;
2267
2270
}
2268
2271
2269
- Hoek . assert ( exception . message === ' Expected [Function] to throw provided type' , exception ) ;
2272
+ Hoek . assert ( / E x p e c t e d \ [F u n c t i o n ( : t h r o w s ) ? \ ] t o t h r o w p r o v i d e d t y p e / . test ( exception . message ) , exception ) ;
2270
2273
done ( ) ;
2271
2274
} ) ;
2272
2275
0 commit comments