Files
dsh-telegram-channel/tests/catalog.test.ts
T
owoandCursor ef0e7f34e3 feat: workspace→session picker and /model switch (v0.3.0)
Align Telegram session list with Web via apiProxy (exclude archived), resume cold sessions on bind, and allow model selection from the phone.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-14 18:46:56 +08:00

29 lines
1.1 KiB
TypeScript

import assert from 'node:assert/strict'
import test from 'node:test'
import {
visibleSessionsForWorkspace,
workspacesWithVisibleSessions,
type CatalogSnapshot,
} from '../src/catalog.ts'
test('visible sessions exclude archived blank and subagent', () => {
const catalog: CatalogSnapshot = {
archivedIds: new Set(['arch']),
sessionsById: new Map([
['ok', { sessionId: 'ok', title: 'OK', blank: false, running: true, updatedAt: 1 }],
['arch', { sessionId: 'arch', title: 'Arch', blank: false, running: false, updatedAt: 1 }],
['blank', { sessionId: 'blank', title: 'Blank', blank: true, running: false, updatedAt: 1 }],
['sub', { sessionId: 'sub', title: 'Sub', blank: false, running: false, origin: 'subagent', updatedAt: 1 }],
]),
workspaces: [{
id: 'w',
title: 'W',
path: '/w',
sessionIds: ['ok', 'arch', 'blank', 'sub', 'missing'],
}],
}
const rows = visibleSessionsForWorkspace(catalog, catalog.workspaces[0]!)
assert.deepEqual(rows.map((r) => r.sessionId), ['ok'])
assert.equal(workspacesWithVisibleSessions(catalog).length, 1)
})