755bf80858
新增 Godot 项目选择、校验、导入和项目上下文切换入口。 只在所选项目根保留 .agent 元数据,并让总控使用标准运行档。 修复发布版原生 API 访问和 React runtime 重复加载问题。 收紧 Provider 工具 Schema 子集并增加回归门禁。 补充 Rust、前端测试及 PRD、技术方案和共享决策记录。
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import {
|
|
AGC_DEVELOPMENT_API_BASE_URL,
|
|
resolveClientHttpTarget,
|
|
} from '../src/services/clientHttp';
|
|
|
|
describe('AGC client HTTP transport', () => {
|
|
it('keeps local development requests on the Vite API proxy', () => {
|
|
expect(
|
|
resolveClientHttpTarget('/api/auth/me', {
|
|
isDevelopment: true,
|
|
isTauri: true,
|
|
pageProtocol: 'http:',
|
|
}),
|
|
).toEqual({ transport: 'web', url: '/api/auth/me' });
|
|
});
|
|
|
|
it('routes release Tauri requests through the scoped dev API transport', () => {
|
|
expect(
|
|
resolveClientHttpTarget('/api/auth/me', {
|
|
isDevelopment: false,
|
|
isTauri: true,
|
|
pageProtocol: 'tauri:',
|
|
}),
|
|
).toEqual({
|
|
transport: 'tauri-http',
|
|
url: `${AGC_DEVELOPMENT_API_BASE_URL}/api/auth/me`,
|
|
});
|
|
});
|
|
|
|
it('keeps ordinary web releases on same-origin relative requests', () => {
|
|
expect(
|
|
resolveClientHttpTarget('/api/auth/me', {
|
|
isDevelopment: false,
|
|
isTauri: false,
|
|
pageProtocol: 'https:',
|
|
}),
|
|
).toEqual({ transport: 'web', url: '/api/auth/me' });
|
|
});
|
|
|
|
it('rejects release Tauri requests outside the fixed dev API origin', () => {
|
|
expect(() =>
|
|
resolveClientHttpTarget('https://example.com/api/auth/me', {
|
|
isDevelopment: false,
|
|
isTauri: true,
|
|
pageProtocol: 'tauri:',
|
|
}),
|
|
).toThrow('不在允许的开发服务器范围内');
|
|
});
|
|
});
|