Skip to content

Commit d8a862c

Browse files
test(api): stub APIUserAbortError in the friendli openai mock
friendli.spec.ts mocks openai with only the default export, while this branch adds the APIUserAbortError import at api/providers/utils/error-handler.ts:12 and reads it in handleOpenAIRequestError at :150 and :160, so vitest's missing-export error replaced the 401 the test asserts at friendli.spec.ts:104:29 and the thrown boom at :248 and :266 in CI job 129957461109: 2 failed of 66 for that spec twice at this head, 66 passed twice at main tip 18861b2, CI ubuntu and local Windows agreeing exactly. The mock now stubs the export the way the ten sibling provider specs on this branch already do, rather than production error handling bending around a test double.
1 parent 4072f40 commit d8a862c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎src/api/providers/__tests__/friendli.spec.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ vi.mock("../fetchers/friendli", () => ({ getFriendliModels: mockGetFriendliModel
2525

2626
// Mock OpenAI module
2727
vi.mock("openai", () => ({
28+
// 1311 adds an APIUserAbortError import at api/providers/utils/error-handler.ts:12 and reads
29+
// it in handleOpenAIRequestError at :150 and :160, so a mock without that named export lets
30+
// vitest's missing-export error replace the 401 job 129957461109 saw asserted at
31+
// friendli.spec.ts:104:29 (2 failed of 66 twice at this head against 66 passed twice at
32+
// main tip 18861b2e3572, CI ubuntu and local Windows agreeing exactly). Ten sibling
33+
// provider specs already stub the export; this mock joins them rather than bending
34+
// production error handling around a test double.
35+
APIUserAbortError: class extends Error {},
2836
default: vi.fn(function () {
2937
return {
3038
chat: {

0 commit comments

Comments
 (0)