refactor: 统一项目名称从OpenFang到ZCLAW
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
重构所有代码和文档中的项目名称,将OpenFang统一更新为ZCLAW。包括: - 配置文件中的项目名称 - 代码注释和文档引用 - 环境变量和路径 - 类型定义和接口名称 - 测试用例和模拟数据 同时优化部分代码结构,移除未使用的模块,并更新相关依赖项。
This commit is contained in:
@@ -365,7 +365,7 @@ describe('chatStore stream correlation', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('chatStore OpenFang events', () => {
|
||||
describe('chatStore ZCLAW events', () => {
|
||||
beforeEach(() => {
|
||||
chatMock.mockReset();
|
||||
onAgentStreamMock.mockClear();
|
||||
|
||||
@@ -82,7 +82,7 @@ const mockClient = {
|
||||
listScheduledTasks: vi.fn(async () => ({
|
||||
tasks: [{ id: 'task_1', name: 'Daily Summary', schedule: '0 9 * * *', status: 'active' }],
|
||||
})),
|
||||
// OpenFang methods
|
||||
// ZCLAW methods
|
||||
listHands: vi.fn(async () => ({
|
||||
hands: [
|
||||
{ name: 'echo', description: 'Echo handler', status: 'active' },
|
||||
@@ -233,7 +233,7 @@ function resetClientMocks() {
|
||||
mockClient.listChannels.mockReset();
|
||||
mockClient.getFeishuStatus.mockReset();
|
||||
mockClient.listScheduledTasks.mockReset();
|
||||
// OpenFang mocks
|
||||
// ZCLAW mocks
|
||||
mockClient.listHands.mockReset();
|
||||
mockClient.triggerHand.mockReset();
|
||||
mockClient.listWorkflows.mockReset();
|
||||
@@ -310,7 +310,7 @@ function resetClientMocks() {
|
||||
mockClient.listScheduledTasks.mockResolvedValue({
|
||||
tasks: [{ id: 'task_1', name: 'Daily Summary', schedule: '0 9 * * *', status: 'active' }],
|
||||
});
|
||||
// OpenFang mock defaults
|
||||
// ZCLAW mock defaults
|
||||
mockClient.listHands.mockResolvedValue({
|
||||
hands: [
|
||||
{ name: 'echo', description: 'Echo handler', status: 'idle', requirements_met: true },
|
||||
@@ -488,7 +488,7 @@ describe('gatewayStore desktop flows', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('OpenFang actions', () => {
|
||||
describe('ZCLAW actions', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.resetModules();
|
||||
@@ -601,7 +601,7 @@ describe('OpenFang actions', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('initializes OpenFang state with empty arrays', async () => {
|
||||
it('initializes ZCLAW state with empty arrays', async () => {
|
||||
const { useHandStore } = await import('../../desktop/src/store/handStore');
|
||||
const { useWorkflowStore } = await import('../../desktop/src/store/workflowStore');
|
||||
const { useSecurityStore } = await import('../../desktop/src/store/securityStore');
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/**
|
||||
* OpenFang API Integration Tests
|
||||
* ZCLAW API Integration Tests
|
||||
*
|
||||
* Uses the mock server to test Hands, Workflows, Security, and Audit APIs
|
||||
* via REST endpoints. Does not require WebSocket handshake.
|
||||
*/
|
||||
|
||||
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
|
||||
import { createOpenFangMockServer, MockServerInstance } from '../../fixtures/openfang-mock-server';
|
||||
import { createZclawMockServer, MockServerInstance } from '../../fixtures/zclaw-mock-server';
|
||||
|
||||
describe('OpenFang API Integration', () => {
|
||||
describe('ZCLAW API Integration', () => {
|
||||
let server: MockServerInstance;
|
||||
let baseUrl: string;
|
||||
const testPort = 14200;
|
||||
|
||||
beforeAll(async () => {
|
||||
server = createOpenFangMockServer({ port: testPort });
|
||||
server = createZclawMockServer({ port: testPort });
|
||||
await server.start();
|
||||
baseUrl = server.getHttpUrl();
|
||||
});
|
||||
|
||||
@@ -36,8 +36,8 @@ function resetMocks() {
|
||||
mockClient = createMockClient();
|
||||
|
||||
mockClient.getWorkspaceInfo = vi.fn().mockResolvedValue({
|
||||
path: '~/.openfang/workspace',
|
||||
resolvedPath: '/home/user/.openfang/workspace',
|
||||
path: '~/.zclaw/workspace',
|
||||
resolvedPath: '/home/user/.zclaw/workspace',
|
||||
exists: true,
|
||||
fileCount: 42,
|
||||
totalSize: 1024000,
|
||||
@@ -48,7 +48,7 @@ function resetMocks() {
|
||||
agentName: 'ZCLAW',
|
||||
theme: 'dark',
|
||||
gatewayUrl: 'ws://127.0.0.1:4200/ws',
|
||||
workspaceDir: '~/.openfang/workspace',
|
||||
workspaceDir: '~/.zclaw/workspace',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -257,8 +257,8 @@ describe('configStore', () => {
|
||||
expect(mockClient.getWorkspaceInfo).toHaveBeenCalledTimes(1);
|
||||
const state = useConfigStore.getState();
|
||||
expect(state.workspaceInfo).toMatchObject({
|
||||
path: '~/.openfang/workspace',
|
||||
resolvedPath: '/home/user/.openfang/workspace',
|
||||
path: '~/.zclaw/workspace',
|
||||
resolvedPath: '/home/user/.zclaw/workspace',
|
||||
exists: true,
|
||||
fileCount: 42,
|
||||
totalSize: 1024000,
|
||||
|
||||
18
tests/fixtures/zclaw-mock-server.ts
vendored
18
tests/fixtures/zclaw-mock-server.ts
vendored
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* OpenFang Mock Server for Testing
|
||||
* ZCLAW Mock Server for Testing
|
||||
*
|
||||
* Simulates OpenFang Kernel API endpoints and WebSocket events.
|
||||
* Simulates ZCLAW Kernel API endpoints and WebSocket events.
|
||||
* Provides a complete test double for the ZCLAW desktop client.
|
||||
*
|
||||
* Usage:
|
||||
* const server = createOpenFangMockServer({ port: 4200 });
|
||||
* const server = createZclawMockServer({ port: 4200 });
|
||||
* await server.start();
|
||||
* // ... run tests ...
|
||||
* await server.stop();
|
||||
@@ -127,8 +127,8 @@ const DEFAULT_AGENTS: MockAgent[] = [
|
||||
nickname: 'ZCLAW',
|
||||
scenarios: ['general', 'coding'],
|
||||
model: 'gpt-4',
|
||||
workspaceDir: '~/.openfang/workspaces/default',
|
||||
workspaceResolvedPath: '/home/user/.openfang/workspaces/default',
|
||||
workspaceDir: '~/.zclaw/workspaces/default',
|
||||
workspaceResolvedPath: '/home/user/.zclaw/workspaces/default',
|
||||
restrictFiles: false,
|
||||
privacyOptIn: false,
|
||||
userName: 'User',
|
||||
@@ -159,7 +159,7 @@ const DEFAULT_SECURITY_LAYERS: MockSecurityLayer[] = [
|
||||
|
||||
// === Server Implementation ===
|
||||
|
||||
export function createOpenFangMockServer(config: MockServerConfig = {}): MockServerInstance {
|
||||
export function createZclawMockServer(config: MockServerConfig = {}): MockServerInstance {
|
||||
const {
|
||||
port = 4200,
|
||||
host = '127.0.0.1',
|
||||
@@ -563,8 +563,8 @@ export function createOpenFangMockServer(config: MockServerConfig = {}): MockSer
|
||||
|
||||
function handleGetWorkspace(_req: IncomingMessage, res: ServerResponse): void {
|
||||
sendJson(res, {
|
||||
path: '~/.openfang/workspaces/default',
|
||||
resolvedPath: '/home/user/.openfang/workspaces/default',
|
||||
path: '~/.zclaw/workspaces/default',
|
||||
resolvedPath: '/home/user/.zclaw/workspaces/default',
|
||||
exists: true,
|
||||
fileCount: 42,
|
||||
totalSize: 1024 * 1024 * 5, // 5MB
|
||||
@@ -938,4 +938,4 @@ export function createOpenFangMockServer(config: MockServerConfig = {}): MockSer
|
||||
|
||||
// === Export for CommonJS compatibility ===
|
||||
|
||||
export default createOpenFangMockServer;
|
||||
export default createZclawMockServer;
|
||||
|
||||
Reference in New Issue
Block a user