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.
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
import { createElement, useState } from 'react';
|
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { parse as parseYaml } from 'yaml';
|
|
import { useVisualConfig } from '../src/hooks/useVisualConfig';
|
|
|
|
describe('visual config concurrency', () => {
|
|
test('only applies dirty visual fields to the latest server YAML', () => {
|
|
function Harness() {
|
|
const visualConfig = useVisualConfig();
|
|
const [phase, setPhase] = useState(0);
|
|
|
|
if (phase === 0) {
|
|
visualConfig.loadVisualValuesFromYaml(
|
|
'requests:\n proxy-url: http://old-proxy.example\nobservability:\n logs:\n debug: false\n'
|
|
);
|
|
setPhase(1);
|
|
} else if (phase === 1) {
|
|
visualConfig.setVisualValues({ proxyUrl: 'http://localhost:8080' });
|
|
setPhase(2);
|
|
} else {
|
|
return createElement(
|
|
'pre',
|
|
null,
|
|
visualConfig.applyVisualChangesToYaml(
|
|
'requests:\n proxy-url: http://old-proxy.example\nobservability:\n logs:\n debug: true\n'
|
|
)
|
|
);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
const markup = renderToStaticMarkup(createElement(Harness));
|
|
const merged = markup.slice('<pre>'.length, -'</pre>'.length);
|
|
|
|
expect(parseYaml(merged)).toEqual({
|
|
observability: { logs: { debug: true } },
|
|
requests: { 'proxy-url': 'http://localhost:8080' },
|
|
});
|
|
});
|
|
});
|