Add unit tests for various components and stores in the terminal dashboard

- Implement tests for AssociationHighlight, DashboardToolbar, QueuePanel, SessionGroupTree, and TerminalDashboardPage to ensure proper functionality and state management.
- Create tests for cliSessionStore, issueQueueIntegrationStore, queueExecutionStore, queueSchedulerStore, sessionManagerStore, and terminalGridStore to validate state resets and workspace scoping.
- Mock necessary dependencies and state management hooks to isolate tests and ensure accurate behavior.
This commit is contained in:
catlog22
2026-03-08 21:38:20 +08:00
parent 9aa07e8d01
commit 62d8aa3623
157 changed files with 36544 additions and 71 deletions

View File

@@ -1232,6 +1232,7 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
flowId: execution.flowId,
status: execution.status,
timestamp,
projectPath: workflowDir,
},
});
} catch {
@@ -1247,6 +1248,7 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
payload: {
sessionKey,
timestamp,
projectPath: workflowDir,
},
});
} catch {
@@ -1460,7 +1462,8 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
sessionKey: sessionKey,
stepName: flow.name,
totalSteps: flow.nodes.length,
timestamp: now
timestamp: now,
projectPath: workflowDir,
}
});
@@ -1471,7 +1474,8 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
sessionKey: sessionKey,
reason: `Executing workflow: ${flow.name}`,
executionId: execId,
timestamp: now
timestamp: now,
projectPath: workflowDir,
}
});
@@ -1731,6 +1735,7 @@ export async function handleOrchestratorRoutes(ctx: RouteContext): Promise<boole
flowId: execution.flowId,
reason: 'User requested stop',
timestamp: now,
projectPath: workflowDir,
},
});

View File

@@ -397,8 +397,9 @@ export class CliSessionManager {
payload: {
sessionKey,
data,
timestamp: nowIso()
} satisfies CliSessionOutputEvent
timestamp: nowIso(),
projectPath: this.projectRoot,
} satisfies CliSessionOutputEvent & { projectPath: string }
});
});
@@ -410,7 +411,8 @@ export class CliSessionManager {
sessionKey,
exitCode,
signal,
timestamp: nowIso()
timestamp: nowIso(),
projectPath: this.projectRoot,
}
});
});
@@ -426,7 +428,11 @@ export class CliSessionManager {
broadcastToClients({
type: 'CLI_SESSION_CREATED',
payload: { session: this.getSession(sessionKey), timestamp: nowIso() }
payload: {
session: this.getSession(sessionKey),
timestamp: nowIso(),
projectPath: this.projectRoot,
}
});
return this.getSession(sessionKey)!;
@@ -464,7 +470,14 @@ export class CliSessionManager {
session.pty.kill();
} finally {
this.sessions.delete(sessionKey);
broadcastToClients({ type: 'CLI_SESSION_CLOSED', payload: { sessionKey, timestamp: nowIso() } });
broadcastToClients({
type: 'CLI_SESSION_CLOSED',
payload: {
sessionKey,
timestamp: nowIso(),
projectPath: this.projectRoot,
}
});
}
}
@@ -486,7 +499,11 @@ export class CliSessionManager {
session.updatedAt = nowIso();
broadcastToClients({
type: 'CLI_SESSION_PAUSED',
payload: { sessionKey, timestamp: nowIso() }
payload: {
sessionKey,
timestamp: nowIso(),
projectPath: this.projectRoot,
}
});
} catch (err) {
throw new Error(`Failed to pause session ${sessionKey}: ${(err as Error).message}`);
@@ -512,7 +529,11 @@ export class CliSessionManager {
session.lastActivityAt = Date.now();
broadcastToClients({
type: 'CLI_SESSION_RESUMED',
payload: { sessionKey, timestamp: nowIso() }
payload: {
sessionKey,
timestamp: nowIso(),
projectPath: this.projectRoot,
}
});
} catch (err) {
throw new Error(`Failed to resume session ${sessionKey}: ${(err as Error).message}`);