@@ -13,21 +13,21 @@ describe('assertType', () => {
1313 } ) ;
1414
1515 it ( 'should throw an error if invalid objects are passed to it' , ( ) => {
16- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d a n o b j e c t $ / ;
16+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d a n o b j e c t , f o u n d : . * $ / ;
1717 assert . throws ( ( ) => assertType < { foo : string } > ( 0 ) , expectedMessageRegExp ) ;
1818 assert . throws ( ( ) => assertType < { foo : string } > ( [ ] ) , expectedMessageRegExp ) ;
1919 assert . throws ( ( ) => assertType < { foo : string } > ( null ) , expectedMessageRegExp ) ;
2020 assert . throws ( ( ) => assertType < { foo : string } > ( true ) , expectedMessageRegExp ) ;
2121 } ) ;
2222
2323 it ( 'should throw an error if objects without foo are passed to it' , ( ) => {
24- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d ' f o o ' i n o b j e c t $ / ;
24+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d ' f o o ' i n o b j e c t , f o u n d : . * $ / ;
2525 assert . throws ( ( ) => assertType < { foo : string } > ( { } ) , expectedMessageRegExp ) ;
2626 assert . throws ( ( ) => assertType < { foo : string } > ( { bar : 'baz' } ) , expectedMessageRegExp ) ;
2727 } ) ;
2828
2929 it ( 'should throw an error if objects with foo not a string are passed to it' , ( ) => {
30- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ \. f o o : e x p e c t e d a s t r i n g $ / ;
30+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ \. f o o : e x p e c t e d a s t r i n g , f o u n d : . * $ / ;
3131 assert . throws ( ( ) => assertType < { foo : string } > ( { foo : 0 } ) , expectedMessageRegExp ) ;
3232 assert . throws ( ( ) => assertType < { foo : string } > ( { foo : false } ) , expectedMessageRegExp ) ;
3333 } ) ;
@@ -43,21 +43,21 @@ describe('assertType', () => {
4343 } ) ;
4444
4545 it ( 'should throw an error if objects without foo are passed to it' , ( ) => {
46- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d ' f o o ' i n o b j e c t $ / ;
46+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d ' f o o ' i n o b j e c t , f o u n d : . * $ / ;
4747 assert . throws ( ( ) => assertType < { foo : string } > ( { } ) , expectedMessageRegExp ) ;
4848 assert . throws ( ( ) => assertType < { foo : string } > ( { bar : 'baz' } ) , expectedMessageRegExp ) ;
4949 } ) ;
5050
5151 it ( 'should throw an error if invalid objects are passed to it' , ( ) => {
52- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d a n o b j e c t $ / ;
52+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d a n o b j e c t , f o u n d : . * $ / ;
5353 assert . throws ( ( ) => assertType < { foo : number [ ] } > ( 0 ) , expectedMessageRegExp ) ;
5454 assert . throws ( ( ) => assertType < { foo : number [ ] } > ( null ) , expectedMessageRegExp ) ;
5555 assert . throws ( ( ) => assertType < { foo : number [ ] } > ( true ) , expectedMessageRegExp ) ;
5656 } ) ;
5757
5858 it ( 'should throw an error if objects where foo is not an array of numbers are passed to it' , ( ) => {
59- const expectedMessageRegExp1 = / v a l i d a t i o n f a i l e d a t \$ \. f o o \. \[ 1 \] : e x p e c t e d a n u m b e r $ / ;
60- const expectedMessageRegExp2 = / v a l i d a t i o n f a i l e d a t \$ \. f o o \. \[ 0 \] : e x p e c t e d a n u m b e r $ / ;
59+ const expectedMessageRegExp1 = / v a l i d a t i o n f a i l e d a t \$ \. f o o \. \[ 1 \] : e x p e c t e d a n u m b e r , f o u n d : . * $ / ;
60+ const expectedMessageRegExp2 = / v a l i d a t i o n f a i l e d a t \$ \. f o o \. \[ 0 \] : e x p e c t e d a n u m b e r , f o u n d : . * $ / ;
6161 assert . throws ( ( ) => assertType < { foo : number [ ] } > ( { foo : [ 0 , '0' ] } ) , expectedMessageRegExp1 ) ;
6262 assert . throws ( ( ) => assertType < { foo : number [ ] } > ( { foo : [ '1' ] } ) , expectedMessageRegExp2 ) ;
6363 assert . throws ( ( ) => assertType < { foo : number [ ] } > ( { foo : [ { } ] } ) , expectedMessageRegExp2 ) ;
@@ -77,35 +77,35 @@ describe('assertType', () => {
7777 } ) ;
7878
7979 it ( 'should throw an error if nested objects with foo not \'bar\' or \'baz\' are passed to it' , ( ) => {
80- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ \. n e s t e d \. f o o : t h e r e a r e n o v a l i d a l t e r n a t i v e s $ / ;
80+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ \. n e s t e d \. f o o : t h e r e a r e n o v a l i d a l t e r n a t i v e s , f o u n d : . * $ / ;
8181 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : { foo : 'qux' } } ) , expectedMessageRegExp ) ;
8282 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : { foo : 0 } } ) , expectedMessageRegExp ) ;
8383 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : { foo : [ ] } } ) , expectedMessageRegExp ) ;
8484 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : { foo : { } } } ) , expectedMessageRegExp ) ;
8585 } ) ;
8686
8787 it ( 'should throw an error if nested objects without foo are passed to it' , ( ) => {
88- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ \. n e s t e d : e x p e c t e d ' f o o ' i n o b j e c t $ / ;
88+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ \. n e s t e d : e x p e c t e d ' f o o ' i n o b j e c t , f o u n d : . * $ / ;
8989 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : { } } ) , expectedMessageRegExp ) ;
9090 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : { foh : 'bar' } } ) , expectedMessageRegExp ) ;
9191 } ) ;
9292
9393 it ( 'should throw an error if nested properties that are not objects are passed to it' , ( ) => {
94- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ \. n e s t e d : e x p e c t e d a n o b j e c t $ / ;
94+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ \. n e s t e d : e x p e c t e d a n o b j e c t , f o u n d : . * $ / ;
9595 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : 0 } ) , expectedMessageRegExp ) ;
9696 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : true } ) , expectedMessageRegExp ) ;
9797 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : null } ) , expectedMessageRegExp ) ;
9898 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nested : [ ] } ) , expectedMessageRegExp ) ;
9999 } ) ;
100100
101101 it ( 'should throw an error if objects without nested are passed to it' , ( ) => {
102- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d ' n e s t e d ' i n o b j e c t $ / ;
102+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d ' n e s t e d ' i n o b j e c t , f o u n d : . * $ / ;
103103 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nisted : { foo : 'bar' } } ) , expectedMessageRegExp ) ;
104104 assert . throws ( ( ) => assertType < { nested : Nested } > ( { nisted : { foh : 'baz' } } ) , expectedMessageRegExp ) ;
105105 } ) ;
106106
107107 it ( 'should throw an error if other objects are passed to it' , ( ) => {
108- const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d a n o b j e c t $ / ;
108+ const expectedMessageRegExp = / v a l i d a t i o n f a i l e d a t \$ : e x p e c t e d a n o b j e c t , f o u n d : . * $ / ;
109109 assert . throws ( ( ) => assertType < { nested : Nested } > ( '0' ) , expectedMessageRegExp ) ;
110110 assert . throws ( ( ) => assertType < { nested : Nested } > ( 1 ) , expectedMessageRegExp ) ;
111111 assert . throws ( ( ) => assertType < { nested : Nested } > ( [ ] ) , expectedMessageRegExp ) ;
@@ -122,8 +122,8 @@ describe('assertType', () => {
122122 } ) ;
123123
124124 it ( 'should throw an error if objects with non-boolen values are passed to it' , ( ) => {
125- const expectedMessageRegExp1 = / v a l i d a t i o n f a i l e d a t \$ \. f o o : e x p e c t e d a b o o l e a n $ / ;
126- const expectedMessageRegExp2 = / v a l i d a t i o n f a i l e d a t \$ \. b a r : e x p e c t e d a b o o l e a n $ / ;
125+ const expectedMessageRegExp1 = / v a l i d a t i o n f a i l e d a t \$ \. f o o : e x p e c t e d a b o o l e a n , f o u n d : . * $ / ;
126+ const expectedMessageRegExp2 = / v a l i d a t i o n f a i l e d a t \$ \. b a r : e x p e c t e d a b o o l e a n , f o u n d : . * $ / ;
127127 assert . throws ( ( ) => assertType < { [ Key : string ] : boolean } > ( { foo : 0 } ) , expectedMessageRegExp1 ) ;
128128 assert . throws ( ( ) => assertType < { [ Key : string ] : boolean } > ( { bar : 'foo' } ) , expectedMessageRegExp2 ) ;
129129 assert . throws ( ( ) => assertType < { [ Key : string ] : boolean } > ( { bar : [ ] } ) , expectedMessageRegExp2 ) ;
0 commit comments