Skip to content

Commit 7788091

Browse files
test: update error handling to check AxiosError response for status code
1 parent 3980e94 commit 7788091

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/api/live-preview.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ describe("Live preview query Entry API tests", () => {
131131
expect(result.updated_by).toBeDefined();
132132
} catch (error: any) {
133133
expect(error).toBeDefined();
134-
const errorData = JSON.parse(error);
135-
expect(errorData.status).toEqual(403);
134+
// AxiosError: error.response contains the response object
135+
expect(error.response).toBeDefined();
136+
expect(error.response.status).toEqual(403);
136137
}
137138
});
138139

0 commit comments

Comments
 (0)