Skip to content

Commit d207ced

Browse files
committed
Fix syntax error matching
1 parent f291d09 commit d207ced

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ describe('fetchBaseQuery', () => {
176176
expect(res.meta?.response).toBeInstanceOf(Object)
177177
expect(res.error).toEqual({
178178
status: 'PARSING_ERROR',
179-
error:
180-
'SyntaxError: Unexpected token \'h\', "this is not json!" is not valid JSON',
179+
error: expect.stringMatching(/SyntaxError: Unexpected token/),
181180
originalStatus: 200,
182181
data: `this is not json!`,
183182
})
@@ -335,8 +334,7 @@ describe('fetchBaseQuery', () => {
335334
expect(res.meta?.response).toBeInstanceOf(Object)
336335
expect(res.error).toEqual({
337336
status: 'PARSING_ERROR',
338-
error:
339-
'SyntaxError: Unexpected token \'h\', "this is not json!" is not valid JSON',
337+
error: expect.stringMatching(/SyntaxError: Unexpected token/),
340338
originalStatus: 500,
341339
data: `this is not json!`,
342340
})

0 commit comments

Comments
 (0)