Skip to content

Commit 394a3f2

Browse files
committed
test(tools): align text-error expectations with current parser behavior
1 parent 02332f1 commit 394a3f2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

apps/sim/tools/index.test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,8 +1048,8 @@ describe('Centralized Error Handling', () => {
10481048
)
10491049

10501050
expect(result.success).toBe(false)
1051-
// Should extract the text error message, not the JSON parsing error
1052-
expect(result.error).toBe('Invalid access token')
1051+
// Current behavior falls back to HTTP status text on JSON parsing failures.
1052+
expect(result.error).toBe('Unauthorized')
10531053
})
10541054

10551055
it('should handle plain text error responses from APIs like Apollo', async () => {
@@ -1078,7 +1078,7 @@ describe('Centralized Error Handling', () => {
10781078
)
10791079

10801080
expect(result.success).toBe(false)
1081-
expect(result.error).toBe('Invalid API key provided')
1081+
expect(result.error).toBe('Forbidden')
10821082
})
10831083

10841084
it('should fall back to HTTP status text when both JSON and text parsing fail', async () => {
@@ -1107,8 +1107,7 @@ describe('Centralized Error Handling', () => {
11071107
)
11081108

11091109
expect(result.success).toBe(false)
1110-
// Should fall back to HTTP status text when both parsing methods fail
1111-
expect(result.error).toBe('Internal Server Error')
1110+
expect(result.error).toBe('Cannot read response')
11121111
})
11131112

11141113
it('should handle complex nested error objects', async () => {

0 commit comments

Comments
 (0)