import {expect, test} from 'bun:test' import {mentions, recommended} from '@/lib/mentions' const known = {sessions: ['bridge-cse_01KwD2Aww', 'gate-bridge-cse_01Me', 'session-s2', 'midas', 'cartopolis'], hosted: ['s2', 's3'], todos: ['t7', 't8'], self: 'session-s2'} test('names of other sessions and open ends, not its own', () => { const m = mentions('midas t7: the other session\'s leftover task, after bridge-cse_01KwD2Aww lands; s3 waits too; not s2', known) expect(m.sessions.sort()).toEqual(['bridge-cse_01KwD2Aww', 'session-s3']) expect(m.todos).toEqual(['t7']) expect(m.others).toBe(true) }) test('a worktree named like a word is not taken for one', () => { expect(mentions('Deploy midas to the hub, then cartopolis', known).sessions).toEqual([]) }) test('a question about nobody else is not one', () => { const m = mentions('Land the Brotli branch and roll it out?', known) expect(m).toEqual({sessions: [], todos: [], others: false}) expect(mentions('Wait for another agent to finish?', known).others).toBe(true) expect(mentions('t70 and ttt7 are not open ends', known).todos).toEqual([]) }) test('the recommended mark comes off the label', () => { expect(recommended('Land and roll out (Recommended)')).toEqual({label: 'Land and roll out', rec: true}) expect(recommended('Hold')).toEqual({label: 'Hold', rec: false}) })