mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-10-16 14:57:05 +08:00
- Updated test cases in `providerWeightTransformers.test.ts` to reflect changes in API key structure from 'api-key-entries' to 'keys'. - Introduced new tests in `providerWorkbenchUi.test.ts` to verify the editing surface of provider workbench. - Modified `sponsorCustomEndpoint.test.ts` to adapt to the new API key structure. - Adjusted `visualConfigAntigravitySensitiveWords.test.ts` and `visualConfigConcurrency.test.ts` to accommodate new YAML structure for sensitive words and concurrency settings. - Enhanced `visualConfigDefaults.test.ts` to ensure proper handling of boolean defaults and YAML structure. - Updated `visualConfigDevinSensitiveWords.test.ts` to reflect changes in the YAML structure for sensitive words. - Refined `visualConfigDisableImageGeneration.test.ts` to align with new multimedia settings. - Added comprehensive tests in `visualConfigV8.test.ts` to validate the v8 visual config contract and ensure scalar read/write path parity. - Improved validation tests in `visualConfigValidation.test.ts` to handle new routing and requests structure. - Cleaned up `xaiApiKeyProvider.test.ts` by removing unnecessary API client mocks and focusing on normalization of the xAI API key contract.
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { describe, expect, spyOn, test } from 'bun:test';
|
|
import i18n from '@/i18n';
|
|
import { DEVIN_CONFIG } from '@/features/quota/providers/devin/data';
|
|
import { apiClient } from '@/services/api/client';
|
|
import { authFilesApi } from '@/services/api/authFiles';
|
|
|
|
describe('Devin quota Management API integration', () => {
|
|
test('queries only api-call with a body token placeholder, not auth-file refresh or list', async () => {
|
|
const post = spyOn(apiClient, 'post').mockResolvedValue({
|
|
status_code: 200,
|
|
header: {},
|
|
body: JSON.stringify({
|
|
userStatus: {
|
|
planStatus: { dailyQuotaRemainingPercent: 54, weeklyQuotaRemainingPercent: 77 },
|
|
},
|
|
}),
|
|
});
|
|
const refresh = spyOn(authFilesApi, 'requestManualRefresh');
|
|
const list = spyOn(authFilesApi, 'list');
|
|
try {
|
|
const result = await DEVIN_CONFIG.fetchQuota(
|
|
{ name: 'live.json', type: 'devin', auth_index: ' 42 ' },
|
|
i18n.t
|
|
);
|
|
expect(post).toHaveBeenCalledTimes(1);
|
|
expect(post.mock.calls[0][0]).toBe('/requests/api-call');
|
|
expect(post.mock.calls[0][1]).toMatchObject({
|
|
authIndex: '42',
|
|
method: 'POST',
|
|
header: { 'Content-Type': 'application/json', 'Connect-Protocol-Version': '1' },
|
|
});
|
|
expect(refresh).not.toHaveBeenCalled();
|
|
expect(list).not.toHaveBeenCalled();
|
|
expect(result.windows.map((window) => window.remainingPercent)).toEqual([54, 77]);
|
|
} finally {
|
|
post.mockRestore();
|
|
refresh.mockRestore();
|
|
list.mockRestore();
|
|
}
|
|
});
|
|
});
|