reuse status dashboard message and simplify settings actions

This commit is contained in:
ejclaw
2026-05-02 01:59:38 +09:00
parent 97259244a0
commit 422ad331bb
8 changed files with 230 additions and 103 deletions

View File

@@ -5,6 +5,7 @@ import {
buildWebUsageRowsForSnapshot,
formatStatusHeader,
renderUsageTable,
shouldPurgeDashboardChannelOnStart,
summarizeWatcherTasks,
} from './unified-dashboard.js';
@@ -61,6 +62,32 @@ describe('formatStatusHeader', () => {
});
});
describe('shouldPurgeDashboardChannelOnStart', () => {
it('keeps the existing status message when a stored message id exists', () => {
expect(
shouldPurgeDashboardChannelOnStart({
purgeOnStart: true,
storedMessageId: 'status-message-1',
}),
).toBe(false);
});
it('purges only when explicitly requested and no stored message id exists', () => {
expect(
shouldPurgeDashboardChannelOnStart({
purgeOnStart: true,
storedMessageId: null,
}),
).toBe(true);
expect(
shouldPurgeDashboardChannelOnStart({
purgeOnStart: false,
storedMessageId: null,
}),
).toBe(false);
});
});
describe('renderUsageTable', () => {
const claudeRow: UsageRow = {
name: 'Claude pro',