mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-13 19:20:04 +00:00
🌐 chore: translate non-English comments to English in tests-utils and heterogeneous-agents (#14914)
This commit is contained in:
@@ -95,7 +95,7 @@ const TASK_CREATE_RESULT_PATTERN = /^Task #(\d+) created successfully/;
|
||||
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
|
||||
* session mid-stream and missed earlier Create / Update events, parsing
|
||||
* TaskList rebuilds id / subject / status. `activeForm` and `description`
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+8
-8
@@ -1,7 +1,7 @@
|
||||
import { type PropsWithChildren } from 'react';
|
||||
import { SWRConfig } from 'swr';
|
||||
|
||||
// 全局的 SWR 配置
|
||||
// Global SWR configuration
|
||||
const swrConfig = {
|
||||
provider: () => new Map(),
|
||||
};
|
||||
@@ -11,11 +11,11 @@ export const withSWR = ({ children }: PropsWithChildren) => (
|
||||
);
|
||||
|
||||
interface TestServiceOptions {
|
||||
/** 是否检查 async */
|
||||
/** Whether to check async */
|
||||
checkAsync?: boolean;
|
||||
/** 自定义的额外检查 */
|
||||
/** Custom additional checks */
|
||||
extraChecks?: (method: string, func: () => any) => void;
|
||||
/** 是否跳过某些方法 */
|
||||
/** Whether to skip certain methods */
|
||||
skipMethods?: string[];
|
||||
}
|
||||
|
||||
@@ -34,20 +34,20 @@ export const testService = (ServiceClass: new () => any, options: TestServiceOpt
|
||||
|
||||
methods.forEach((method) => {
|
||||
const func = service[method];
|
||||
// 检查是否为函数
|
||||
// Check if it's a function
|
||||
expect(typeof func).toBe('function');
|
||||
|
||||
const funcString = func.toString();
|
||||
|
||||
// 验证是否是箭头函数
|
||||
// Verify if it's an arrow function
|
||||
expect(funcString).toContain('=>');
|
||||
|
||||
// 可选的 async 检查
|
||||
// Optional async check
|
||||
if (checkAsync) {
|
||||
expect(funcString).toMatch(/^async.*=>/);
|
||||
}
|
||||
|
||||
// 运行额外的自定义检查
|
||||
// Run additional custom checks
|
||||
if (extraChecks) {
|
||||
extraChecks(method, func);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user