Repository navigation
Commit 0a14d67
committed
test(mimo): give the openai mock the abort class the error path instanceof-checks
The mimo mock returns a bare default from vi.mock, so openai's APIUserAbortError is absent from
it. handleOpenAIRequestError instanceof-checks that class on every request error, and vitest
fills an absent export with a throwing placeholder: measured on this spec a rejected create comes
back as
OpenAI completion error: [vitest] No "APIUserAbortError" export is defined on the "openai"
mock. Did you forget to return it from "vi.mock"?
so the reason the provider reported is replaced by the mock's own complaint and the abort branch
cannot be reached from mimo at all. Export the same stub class
base-openai-compatible-provider.spec.ts:20 exports, which is what makes the abort half of that
classification reachable through a mimo handler.
The three prefix rows asserted only "OpenAI completion error:", which the wrapper satisfies with
any reason - including the placeholder above. Each now pins the reason text and the status the
wrapper carries for Task.backoffAndAnnounce: 401 and 429 keep their number, and a connection
failure keeps having none. Dropping the status from the 429 double fails that row on "expected
undefined to be 429", and a wrong reason fails the containment, so neither assertion is free.
The prefix is applied twice on this path (openai.ts:425 wraps the rejection, openai.ts:451 wraps
the wrapper), so the reason is pinned by containment rather than as the whole message: the
doubling is this path's real output and belongs to its own question, not to this row.1 parent d8a862c commit 0a14d67
1 file changed
Lines changed: 31 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
| |||
891 | 901 | | |
892 | 902 | | |
893 | 903 | | |
894 | | - | |
| 904 | + | |
895 | 905 | | |
896 | | - | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
897 | 912 | | |
898 | 913 | | |
899 | 914 | | |
| |||
915 | 930 | | |
916 | 931 | | |
917 | 932 | | |
918 | | - | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
919 | 941 | | |
920 | 942 | | |
921 | 943 | | |
922 | | - | |
| 944 | + | |
923 | 945 | | |
924 | | - | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
925 | 951 | | |
926 | 952 | | |
927 | 953 | | |
| |||
0 commit comments