Extract dashboard RoomBoardV2 component (#60)
* 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
This commit is contained in:
92
apps/dashboard/src/RoomBoardV2.test.ts
Normal file
92
apps/dashboard/src/RoomBoardV2.test.ts
Normal file
@@ -0,0 +1,92 @@
|
||||
import { createElement } from 'react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import type { DashboardRoomActivity, StatusSnapshot } from './api';
|
||||
import { messages } from './i18n';
|
||||
import { RoomBoardV2, type RoomBoardV2Props } from './RoomBoardV2';
|
||||
|
||||
const t = messages.ko;
|
||||
|
||||
const snapshot: StatusSnapshot = {
|
||||
serviceId: 'svc-1',
|
||||
assistantName: 'codex',
|
||||
agentType: 'codex',
|
||||
updatedAt: '2026-04-28T04:00:00.000Z',
|
||||
entries: [
|
||||
{
|
||||
jid: 'room-1',
|
||||
name: 'eyejokerdb-main',
|
||||
folder: 'eyejokerdb',
|
||||
agentType: 'codex',
|
||||
status: 'processing',
|
||||
elapsedMs: 180_000,
|
||||
pendingMessages: false,
|
||||
pendingTasks: 3,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const activity: DashboardRoomActivity = {
|
||||
serviceId: 'svc-1',
|
||||
jid: 'room-1',
|
||||
name: 'eyejokerdb-main',
|
||||
folder: 'eyejokerdb',
|
||||
agentType: 'codex',
|
||||
status: 'processing',
|
||||
elapsedMs: 180_000,
|
||||
pendingMessages: false,
|
||||
pendingTasks: 3,
|
||||
messages: [
|
||||
{
|
||||
id: 'bot-1',
|
||||
sender: 'bot-1',
|
||||
senderName: 'owner',
|
||||
content: 'TASK_DONE\n\nprod 배포 완료',
|
||||
timestamp: '2026-04-28T02:00:00.000Z',
|
||||
isFromMe: false,
|
||||
isBotMessage: true,
|
||||
sourceKind: 'bot',
|
||||
},
|
||||
],
|
||||
pairedTask: null,
|
||||
};
|
||||
|
||||
const baseProps: RoomBoardV2Props = {
|
||||
createRequestId: () => 'request-1',
|
||||
formatDate: (value) => value ?? '-',
|
||||
formatDuration: (value) => (value === null ? '-' : `${value}`),
|
||||
formatLiveElapsed: (value) => `${value}`,
|
||||
inbox: [],
|
||||
locale: 'ko',
|
||||
onSelectedJidChange: () => {},
|
||||
onSendRoomMessage: async () => true,
|
||||
pendingMessages: {},
|
||||
roomActivity: { 'room-1': activity },
|
||||
roomActivityLoading: false,
|
||||
roomMessageKey: null,
|
||||
selectedJid: 'room-1',
|
||||
senderRoleClass: (value) =>
|
||||
(value ?? '').toLowerCase().includes('owner') ? 'role-owner' : 'role-human',
|
||||
snapshots: [snapshot],
|
||||
statusLabel: (status) => status,
|
||||
t,
|
||||
};
|
||||
|
||||
describe('RoomBoardV2', () => {
|
||||
it('renders room list and selected detail thread', () => {
|
||||
const html = renderToStaticMarkup(createElement(RoomBoardV2, baseProps));
|
||||
|
||||
expect(html).toContain('eyejokerdb-main');
|
||||
expect(html).toContain('TASK_DONE');
|
||||
expect(html).toContain('prod 배포 완료');
|
||||
});
|
||||
|
||||
it('renders an empty state without snapshots', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
createElement(RoomBoardV2, { ...baseProps, snapshots: [] }),
|
||||
);
|
||||
|
||||
expect(html).toContain(t.rooms.empty);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user