* review: harden readonly git checks and lint verification * test: satisfy readonly reviewer sandbox typing * test: fix readonly reviewer sandbox assertions * test: remove impossible readonly sandbox guards * test: relax readonly sandbox assertions * test: cast readonly sandbox expectation shape * test: cast readonly sandbox expectation through unknown * Phase 0 — STEP_DONE/TASK_DONE split + owner-follow-up integration smoke * Add STEP_DONE guards, verdict storage, and stale delivery suppression * style: format paired stepdone telemetry files * Route STEP_DONE through reviewer * Add structured Discord attachments * style: format structured attachment test * Fix room thread bot output parity * Remove duplicate work item attachment migration from owner branch * Remove legacy dashboard rooms renderer * Extract dashboard parsed body renderer * Extract dashboard redaction helpers * Extract dashboard RoomCardV2 component * Include RoomCardV2 test in vitest suite * Extract dashboard RoomBoardV2 component * Extract dashboard EmptyState component * Extract dashboard InboxPanel component * Split dashboard InboxPanel card renderer * Extract dashboard TaskPanel component
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { createElement } from 'react';
|
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
import type { DashboardTask } from './api';
|
|
import { messages } from './i18n';
|
|
import { TaskPanel, type TaskPanelProps } from './TaskPanel';
|
|
|
|
const t = messages.en;
|
|
|
|
const task: DashboardTask = {
|
|
agentType: 'codex',
|
|
chatJid: 'room-1',
|
|
ciMetadata: null,
|
|
ciProvider: null,
|
|
contextMode: 'group',
|
|
createdAt: '2026-04-28T04:00:00.000Z',
|
|
groupFolder: 'eyejokerdb',
|
|
id: 'task-1',
|
|
isWatcher: false,
|
|
lastResult: '<internal>hidden</internal>Task completed',
|
|
lastRun: '2026-04-28T04:30:00.000Z',
|
|
nextRun: '2026-04-28T05:00:00.000Z',
|
|
promptLength: 42,
|
|
promptPreview: '<internal>hidden</internal>Run production check',
|
|
scheduleType: 'interval',
|
|
scheduleValue: '10m',
|
|
status: 'active',
|
|
suspendedUntil: null,
|
|
};
|
|
|
|
const baseProps: TaskPanelProps = {
|
|
locale: 'en',
|
|
onTaskAction: () => {},
|
|
onTaskCreate: () => {},
|
|
onTaskUpdate: () => {},
|
|
rooms: [{ folder: 'eyejokerdb', jid: 'room-1', name: 'eyejokerdb-main' }],
|
|
taskActionKey: null,
|
|
tasks: [task],
|
|
t,
|
|
};
|
|
|
|
describe('TaskPanel', () => {
|
|
it('renders task groups, actions, and sanitized previews', () => {
|
|
const html = renderToStaticMarkup(createElement(TaskPanel, baseProps));
|
|
|
|
expect(html).toContain(t.tasks.groups.scheduled);
|
|
expect(html).toContain('eyejokerdb-main');
|
|
expect(html).toContain(t.tasks.actions.pause);
|
|
expect(html).toContain(t.tasks.actions.cancel);
|
|
expect(html).toContain('Task completed');
|
|
expect(html).toContain('Run production check');
|
|
expect(html).not.toContain('internal');
|
|
});
|
|
|
|
it('renders an empty state without scheduled tasks', () => {
|
|
const html = renderToStaticMarkup(
|
|
createElement(TaskPanel, { ...baseProps, tasks: [] }),
|
|
);
|
|
|
|
expect(html).toContain(t.tasks.empty);
|
|
});
|
|
});
|