@@ -65,6 +65,14 @@ function expectCompactionCompleteAndAutoClears(host: MutableHost) {
|
65 | 65 | expect(host.compactionClearTimer).toBeNull(); |
66 | 66 | } |
67 | 67 | |
| 68 | +function requireFallbackStatus(host: MutableHost): FallbackStatus { |
| 69 | +expect(host.fallbackStatus).toBeTruthy(); |
| 70 | +if (!host.fallbackStatus) { |
| 71 | +throw new Error("expected fallback status"); |
| 72 | +} |
| 73 | +return host.fallbackStatus; |
| 74 | +} |
| 75 | + |
68 | 76 | function useToolStreamFakeTimers(): void { |
69 | 77 | vi.useFakeTimers({ toFake: ["Date", "setTimeout", "clearTimeout"] }); |
70 | 78 | } |
@@ -107,11 +115,10 @@ describe("app-tool-stream fallback lifecycle handling", () => {
|
107 | 115 | }, |
108 | 116 | }); |
109 | 117 | |
110 | | -expect(host.fallbackStatus?.selected).toBe( |
111 | | -"fireworks/accounts/fireworks/routers/kimi-k2p5-turbo", |
112 | | -); |
113 | | -expect(host.fallbackStatus?.active).toBe("deepinfra/moonshotai/Kimi-K2.5"); |
114 | | -expect(host.fallbackStatus?.reason).toBe("rate limit"); |
| 118 | +const fallbackStatus = requireFallbackStatus(host); |
| 119 | +expect(fallbackStatus.selected).toBe("fireworks/accounts/fireworks/routers/kimi-k2p5-turbo"); |
| 120 | +expect(fallbackStatus.active).toBe("deepinfra/moonshotai/Kimi-K2.5"); |
| 121 | +expect(fallbackStatus.reason).toBe("rate limit"); |
115 | 122 | vi.useRealTimers(); |
116 | 123 | }); |
117 | 124 | |
@@ -194,8 +201,9 @@ describe("app-tool-stream fallback lifecycle handling", () => {
|
194 | 201 | }, |
195 | 202 | }); |
196 | 203 | |
197 | | -expect(host.fallbackStatus?.phase).toBe("cleared"); |
198 | | -expect(host.fallbackStatus?.previous).toBe("deepinfra/moonshotai/Kimi-K2.5"); |
| 204 | +const fallbackStatus = requireFallbackStatus(host); |
| 205 | +expect(fallbackStatus.phase).toBe("cleared"); |
| 206 | +expect(fallbackStatus.previous).toBe("deepinfra/moonshotai/Kimi-K2.5"); |
199 | 207 | vi.useRealTimers(); |
200 | 208 | }); |
201 | 209 | |
|