mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-11-22 16:37:49 +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.
37 lines
1.2 KiB
TypeScript
37 lines
1.2 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 { parseDisableImageGenerationMode, useVisualConfig } from '../src/hooks/useVisualConfig';
|
|
|
|
describe('visual config disable-image-generation', () => {
|
|
test('loads and writes the passthrough mode', () => {
|
|
expect(parseDisableImageGenerationMode('passthrough')).toBe('passthrough');
|
|
|
|
function Harness() {
|
|
const visualConfig = useVisualConfig();
|
|
const [phase, setPhase] = useState(0);
|
|
|
|
if (phase === 0) {
|
|
visualConfig.setVisualValues({ disableImageGeneration: 'passthrough' });
|
|
setPhase(1);
|
|
} else {
|
|
return createElement(
|
|
'pre',
|
|
null,
|
|
visualConfig.applyVisualChangesToYaml('multimedia:\n disable-image-generation: false\n')
|
|
);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
const markup = renderToStaticMarkup(createElement(Harness));
|
|
const result = markup.slice('<pre>'.length, -'</pre>'.length);
|
|
|
|
expect(parseYaml(result)).toEqual({
|
|
multimedia: { 'disable-image-generation': 'passthrough' },
|
|
});
|
|
});
|
|
});
|