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.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { describe, expect, spyOn, test } from 'bun:test';
|
|
import { authFilesApi } from '../src/services/api/authFiles';
|
|
import { apiClient } from '../src/services/api/client';
|
|
|
|
describe('single credential manual refresh', () => {
|
|
test('posts only the selected filename to the dedicated refresh endpoint', async () => {
|
|
const post = spyOn(apiClient, 'post').mockResolvedValue({ ok: true });
|
|
const patch = spyOn(apiClient, 'patch').mockResolvedValue({});
|
|
try {
|
|
const name = 'codex+account@example.com.json';
|
|
await authFilesApi.requestManualRefresh(name);
|
|
|
|
expect(post).toHaveBeenCalledTimes(1);
|
|
expect(post).toHaveBeenCalledWith('/credentials/refresh', { name });
|
|
expect(patch).not.toHaveBeenCalled();
|
|
} finally {
|
|
post.mockRestore();
|
|
patch.mockRestore();
|
|
}
|
|
});
|
|
|
|
test('propagates refresh failures without falling back to metadata edits', async () => {
|
|
const error = new Error('refresh failed');
|
|
const post = spyOn(apiClient, 'post').mockRejectedValue(error);
|
|
const patch = spyOn(apiClient, 'patch').mockResolvedValue({});
|
|
try {
|
|
await expect(authFilesApi.requestManualRefresh('codex.json')).rejects.toThrow(
|
|
'refresh failed'
|
|
);
|
|
expect(post).toHaveBeenCalledTimes(1);
|
|
expect(patch).not.toHaveBeenCalled();
|
|
} finally {
|
|
post.mockRestore();
|
|
patch.mockRestore();
|
|
}
|
|
});
|
|
});
|