@@ -1057,7 +1057,7 @@ describe('Functions tests', () => {
1057
1057
}
1058
1058
) ;
1059
1059
1060
- /* it.each([
1060
+ it . each ( [
1061
1061
{
1062
1062
expression : `join(', ', strings)` ,
1063
1063
expected : 'a, b, c' ,
@@ -1107,39 +1107,51 @@ describe('Functions tests', () => {
1107
1107
1108
1108
// Assess
1109
1109
expect ( result ) . toStrictEqual ( expected ) ;
1110
- }); */
1110
+ } ) ;
1111
1111
1112
- /* it.each([
1112
+ it . each ( [
1113
1113
{
1114
1114
expression : 'join(\',\', `["a", 0]`)' ,
1115
1115
error :
1116
- 'TypeError: join() expected argument 2 to be type (Array<string>) but received type array instead. ',
1116
+ 'Invalid argument type for function join(), expected "string" but found "number" in expression: join(\',\', `["a", 0]`) ' ,
1117
1117
} ,
1118
1118
{
1119
1119
expression : `join(', ', str)` ,
1120
- error:
1121
- 'TypeError: join() expected argument 2 to be type (Array<string>) but received type string instead.',
1120
+ error : `Invalid argument type for function join(), expected "array-string" but found "string" in expression: join(', ', str)` ,
1122
1121
} ,
1123
1122
{
1124
1123
expression : 'join(`2`, strings)' ,
1125
1124
error :
1126
- 'TypeError: join() expected argument 1 to be type (string) but received type number instead. ',
1125
+ 'Invalid argument type for function join(), expected "string" but found " number" in expression: join(`2`, strings) ' ,
1127
1126
} ,
1128
1127
{
1129
1128
expression : `join('|', decimals)` ,
1130
1129
error :
1131
- 'TypeError: join() expected argument 2 to be type (Array<string>) but received type array instead. ',
1130
+ 'Invalid argument type for function join(), expected "string" but found "number" in expression: join(\'|\', decimals) ' ,
1132
1131
} ,
1133
1132
] ) ( 'join() function errors' , ( { expression, error } ) => {
1134
- // TODO: see if we can assert the error type as well in join() errors tests
1135
1133
// Prepare
1136
1134
const data = {
1137
- type: 'object',
1135
+ foo : - 1 ,
1136
+ zero : 0 ,
1137
+ numbers : [ - 1 , 3 , 4 , 5 ] ,
1138
+ array : [ - 1 , 3 , 4 , 5 , 'a' , '100' ] ,
1139
+ strings : [ 'a' , 'b' , 'c' ] ,
1140
+ decimals : [ 1.01 , 1.2 , - 1.5 ] ,
1141
+ str : 'Str' ,
1142
+ false : false ,
1143
+ empty_list : [ ] ,
1144
+ empty_hash : { } ,
1145
+ objects : {
1146
+ foo : 'bar' ,
1147
+ bar : 'baz' ,
1148
+ } ,
1149
+ null_key : null ,
1138
1150
} ;
1139
1151
1140
1152
// Act & Assess
1141
1153
expect ( ( ) => search ( expression , data ) ) . toThrow ( error ) ;
1142
- }); */
1154
+ } ) ;
1143
1155
1144
1156
/* it.each([
1145
1157
{
0 commit comments