🌐 chore: translate non-English comments to English in tests-utils and heterogeneous-agents (#14914)

This commit is contained in:
LobeHub Bot
2026-05-19 10:13:35 +08:00
committed by GitHub
parent 62187d55c5
commit 8ddd8e2cff
3 changed files with 10 additions and 10 deletions
@@ -95,7 +95,7 @@ const TASK_CREATE_RESULT_PATTERN = /^Task #(\d+) created successfully/;
const TASK_UPDATE_RESULT_PATTERN = /^Updated task #\d+/; const TASK_UPDATE_RESULT_PATTERN = /^Updated task #\d+/;
/** /**
* One line of `TaskList`'s plain-text output: `#1 [in_progress] hosts`. * One line of `TaskList`'s plain-text output: `#1 [in_progress] read hosts`.
* Used as the resume reconciliation path — when this adapter joins a CC * Used as the resume reconciliation path — when this adapter joins a CC
* session mid-stream and missed earlier Create / Update events, parsing * session mid-stream and missed earlier Create / Update events, parsing
* TaskList rebuilds id / subject / status. `activeForm` and `description` * TaskList rebuilds id / subject / status. `activeForm` and `description`
+1 -1
View File
@@ -72,5 +72,5 @@ await i18n.init({
}, },
}); });
// React 设置为全局变量,这样就不需要在每个测试文件中导入它了 // Set React as a global variable so it doesn't need to be imported in each test file
(globalThis as any).React = React; (globalThis as any).React = React;
+8 -8
View File
@@ -1,7 +1,7 @@
import { type PropsWithChildren } from 'react'; import { type PropsWithChildren } from 'react';
import { SWRConfig } from 'swr'; import { SWRConfig } from 'swr';
// 全局的 SWR 配置 // Global SWR configuration
const swrConfig = { const swrConfig = {
provider: () => new Map(), provider: () => new Map(),
}; };
@@ -11,11 +11,11 @@ export const withSWR = ({ children }: PropsWithChildren) => (
); );
interface TestServiceOptions { interface TestServiceOptions {
/** 是否检查 async */ /** Whether to check async */
checkAsync?: boolean; checkAsync?: boolean;
/** 自定义的额外检查 */ /** Custom additional checks */
extraChecks?: (method: string, func: () => any) => void; extraChecks?: (method: string, func: () => any) => void;
/** 是否跳过某些方法 */ /** Whether to skip certain methods */
skipMethods?: string[]; skipMethods?: string[];
} }
@@ -34,20 +34,20 @@ export const testService = (ServiceClass: new () => any, options: TestServiceOpt
methods.forEach((method) => { methods.forEach((method) => {
const func = service[method]; const func = service[method];
// 检查是否为函数 // Check if it's a function
expect(typeof func).toBe('function'); expect(typeof func).toBe('function');
const funcString = func.toString(); const funcString = func.toString();
// 验证是否是箭头函数 // Verify if it's an arrow function
expect(funcString).toContain('=>'); expect(funcString).toContain('=>');
// 可选的 async 检查 // Optional async check
if (checkAsync) { if (checkAsync) {
expect(funcString).toMatch(/^async.*=>/); expect(funcString).toMatch(/^async.*=>/);
} }
// 运行额外的自定义检查 // Run additional custom checks
if (extraChecks) { if (extraChecks) {
extraChecks(method, func); extraChecks(method, func);
} }