@@ -143,20 +143,22 @@ describe("destr", () => {
143
143
}
144
144
} ) ;
145
145
146
- it ( "throws an error if it's a invalid JSON texts with safeDestr" , ( ) => {
146
+ describe ( "throws an error if it's a invalid JSON texts with safeDestr" , ( ) => {
147
147
const testCases = [
148
- { input : "{ " , output : "Unexpected end of JSON input " } ,
148
+ { input : "{ " , output : "Expected property name or " } ,
149
149
{ input : "[ " , output : "Unexpected end of JSON input" } ,
150
- { input : '" ' , output : "Unexpected end of JSON input " } ,
151
- { input : "[1,2,3]?" , output : "Unexpected token " } ,
150
+ { input : '" ' , output : "Unterminated string in JSON at position " } ,
151
+ { input : "[1,2,3]?" , output : "Unexpected non-whitespace character " } ,
152
152
{ input : "invalid JSON text" , output : "Invalid JSON" } ,
153
- { input : ' "Invalid' , output : "Unexpected end of JSON input " } ,
153
+ { input : ' "Invalid' , output : "Unterminated string in JSON at position " } ,
154
154
] ;
155
155
156
156
for ( const testCase of testCases ) {
157
- expect ( ( ) => safeDestr ( testCase . input ) ) . toThrowError (
158
- testCase . output || "" ,
159
- ) ;
157
+ it ( testCase . input , ( ) => {
158
+ expect ( ( ) => safeDestr ( testCase . input ) ) . toThrowError (
159
+ testCase . output || "" ,
160
+ ) ;
161
+ } ) ;
160
162
}
161
163
} ) ;
162
164
0 commit comments