mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-11-23 17:27:53 +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.
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
import { computeApiUrl, normalizeApiBase } from '../src/utils/connection';
|
|
import { resolvePluginAssetURL } from '../src/features/plugins/pluginResources';
|
|
|
|
describe('v8-only management connections', () => {
|
|
test.each([
|
|
['localhost:8317', 'http://localhost:8317'],
|
|
[' https://proxy.example/ ', 'https://proxy.example'],
|
|
['https://proxy.example/v8/management/', 'https://proxy.example'],
|
|
['https://proxy.example/gateway/v8/management///', 'https://proxy.example/gateway'],
|
|
])('normalizes %s without changing the deployment prefix', (input, expected) => {
|
|
expect(normalizeApiBase(input)).toBe(expected);
|
|
expect(computeApiUrl(input)).toBe(`${expected}/v8/management`);
|
|
});
|
|
|
|
test('does not create a URL for empty input', () => {
|
|
expect(computeApiUrl(' ')).toBe('');
|
|
});
|
|
|
|
test('does not silently adapt a legacy management URL', () => {
|
|
expect(normalizeApiBase('https://proxy.example/v0/management')).toBe(
|
|
'https://proxy.example/v0/management'
|
|
);
|
|
});
|
|
|
|
test('preserves backend-declared plugin resource and custom extension paths', () => {
|
|
for (const path of ['/v0/resource/plugins/example/index.html', '/v0/management/example']) {
|
|
expect(resolvePluginAssetURL(path, 'https://proxy.example/v8/management')).toBe(
|
|
`https://proxy.example${path}`
|
|
);
|
|
}
|
|
});
|
|
});
|