changes
This commit is contained in:
1 parent
faabf7ba7a
commit
0454aecf70
36 files changed
+719
-227
No files matched your search
@@ -249,9 +249,8 @@ describe('GoogleAPIService fetchQuota fallback policy', () => {
|
||||
} as any);
|
||||
|
||||
const { GoogleAPIService } = await import('../../services/GoogleAPIService');
|
||||
const { FALLBACK_VERSION, resolveLocalInstalledVersion } = await import(
|
||||
'../../server/modules/proxy/request-user-agent'
|
||||
);
|
||||
const { FALLBACK_VERSION, resolveLocalInstalledVersion } =
|
||||
await import('../../server/modules/proxy/request-user-agent');
|
||||
const expectedVersion = resolveLocalInstalledVersion() ?? FALLBACK_VERSION;
|
||||
|
||||
await expect(GoogleAPIService.fetchAICredits('access-token')).resolves.toEqual({
|
||||
@@ -279,13 +278,11 @@ describe('GoogleAPIService fetchQuota fallback policy', () => {
|
||||
});
|
||||
|
||||
it('does not fall through to the next endpoint on permanent 400 errors', async () => {
|
||||
const fetchMock = vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce({
|
||||
ok: false,
|
||||
status: 400,
|
||||
text: vi.fn().mockResolvedValue('INVALID_ARGUMENT'),
|
||||
});
|
||||
const fetchMock = vi.fn().mockResolvedValueOnce({
|
||||
ok: false,
|
||||
status: 400,
|
||||
text: vi.fn().mockResolvedValue('INVALID_ARGUMENT'),
|
||||
});
|
||||
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
|
||||
@@ -405,9 +402,11 @@ describe('QuotaService fallback policy', () => {
|
||||
create: vi.fn(() => ({
|
||||
post: postMock,
|
||||
})),
|
||||
isAxiosError: (error: unknown) => Boolean((error as { isAxiosError?: boolean })?.isAxiosError),
|
||||
isAxiosError: (error: unknown) =>
|
||||
Boolean((error as { isAxiosError?: boolean })?.isAxiosError),
|
||||
},
|
||||
isAxiosError: (error: unknown) => Boolean((error as { isAxiosError?: boolean })?.isAxiosError),
|
||||
isAxiosError: (error: unknown) =>
|
||||
Boolean((error as { isAxiosError?: boolean })?.isAxiosError),
|
||||
}));
|
||||
|
||||
const { QuotaService } = await import('../../lib/geminiNexus/QuotaService');
|
||||
|
||||
@@ -10,6 +10,7 @@ const mockTokenManager = {
|
||||
getNextToken: vi.fn(),
|
||||
markAsRateLimited: vi.fn(),
|
||||
markAsForbidden: vi.fn(),
|
||||
forceRefreshToken: vi.fn(),
|
||||
markFromUpstreamError: vi.fn(),
|
||||
recordParityError: vi.fn(),
|
||||
};
|
||||
@@ -97,5 +98,4 @@ describe('Proxy Parity Fixtures', () => {
|
||||
expect(output).toContain(token);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -8,6 +8,7 @@ const mockTokenManager = {
|
||||
getNextToken: vi.fn(),
|
||||
markAsRateLimited: vi.fn(),
|
||||
markAsForbidden: vi.fn(),
|
||||
forceRefreshToken: vi.fn(),
|
||||
markFromUpstreamError: vi.fn(),
|
||||
recordParityError: vi.fn(),
|
||||
getModelOutputLimitForAccount: vi.fn(),
|
||||
|
||||
@@ -123,11 +123,7 @@ describe('TokenManagerService parity scheduling replay', () => {
|
||||
|
||||
const selected = await (service as any).finalizeSelectedToken('acc-1', tokenData, nowSec);
|
||||
|
||||
expect(refreshSpy).toHaveBeenCalledWith(
|
||||
'refresh-1',
|
||||
'http://127.0.0.1:8080',
|
||||
'custom-client',
|
||||
);
|
||||
expect(refreshSpy).toHaveBeenCalledWith('refresh-1', 'http://127.0.0.1:8080', 'custom-client');
|
||||
expect(selected?.token.oauth_client_key).toBe('custom-fallback');
|
||||
expect((service as any).tokens.get('acc-1')?.oauth_client_key).toBe('custom-fallback');
|
||||
|
||||
|
||||
Reference in new issue
Block a user