qwen-code/packages/web-shell/client/vite-config.test.ts
jinye 2210a18482
feat(web-shell): Scope voice to composer workspace (#7754)
* feat(web-shell): Scope voice to composer workspace

Route voice status, settings, model discovery, and streaming through the workspace that owns each main or split-view composer while preserving legacy primary behavior.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(web-shell): Keep legacy voice fallback scoped

Prevent the Voice-only legacy workspace fallback from activating pre-session git polling, and cover both behaviors together.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(web-shell): Preserve active Voice capture owners

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(web-shell): Pin Voice trust and ambiguity gates

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-07-27 15:47:45 +00:00

36 lines
1 KiB
TypeScript

/**
* @license
* Copyright 2025 Qwen
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, expect, it } from 'vitest';
import type { ConfigEnv, UserConfig } from 'vite';
import viteConfig, { QUALIFIED_VOICE_STREAM_PROXY } from '../vite.config';
describe('Web Shell Voice development proxy', () => {
it('proxies only qualified Voice stream upgrades', () => {
const factory = viteConfig as (env: ConfigEnv) => UserConfig;
const config = factory({
command: 'serve',
mode: 'test',
isSsrBuild: false,
isPreview: false,
});
const proxy = config.server?.proxy;
const qualified = proxy?.[QUALIFIED_VOICE_STREAM_PROXY];
expect(qualified).not.toBeTypeOf('string');
expect(
qualified && typeof qualified !== 'string' ? qualified.ws : false,
).toBe(true);
expect(
new RegExp(QUALIFIED_VOICE_STREAM_PROXY).test(
'/workspaces/id/voice/stream',
),
).toBe(true);
expect(
new RegExp(QUALIFIED_VOICE_STREAM_PROXY).test('/voice/voiceModels.ts'),
).toBe(false);
});
});