feat: add OpenAI OAuth, strict model overrides, and Gmail pull mode
This commit is contained in:
@@ -438,4 +438,29 @@ describe('setClient and labels', () => {
|
||||
expect(newFastClient!.chat).toHaveBeenCalledTimes(1);
|
||||
expect(initialFastClient!.chat).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('strict tier mode disables fallback chain for that tier', async () => {
|
||||
const failingDefault = {
|
||||
chat: vi.fn().mockRejectedValue(new Error('primary failed')),
|
||||
} as unknown as ModelClient;
|
||||
const fallback = {
|
||||
chat: vi.fn().mockResolvedValue({
|
||||
content: 'fallback',
|
||||
stopReason: 'end_turn',
|
||||
usage: { inputTokens: 1, outputTokens: 1 },
|
||||
}),
|
||||
} as unknown as ModelClient;
|
||||
|
||||
const router = new ModelRouter({
|
||||
default: failingDefault,
|
||||
fallbackChain: [fallback],
|
||||
});
|
||||
|
||||
router.setTierStrict('default', true);
|
||||
|
||||
await expect(router.chat({ messages: [{ role: 'user', content: 'Hi' }] }, 'default'))
|
||||
.rejects.toThrow('primary failed');
|
||||
expect(fallback.chat).not.toHaveBeenCalled();
|
||||
expect(router.isTierStrict('default')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user