apps/web/src/lib/agendaListing.test.ts
1import { expect, test } from 'bun:test'
2import type { AgendaSession } from '@local/ai/components/api/pineconeUpload'
3import { speakingPerson, stageListingReply } from './agendaListing'
4
5test('speaker status parsing does not infer a name from a general roster question', () => {
6 expect(speakingPerson('Is Elon Musk speaking at UNLEASH?')).toBe('Elon Musk')
7 expect(speakingPerson('Will Josh Bersin be speaking?')).toBe('Josh Bersin')
8 expect(speakingPerson('Who is speaking?')).toBeUndefined()
9 expect(speakingPerson('Is there anyone speaking about AI?')).toBeUndefined()
10})
11
12test('stage listing keeps speakers and dates attached to sessions and never matches Stage 10 for Stage 1', () => {
13 const session: AgendaSession = {
14 title: 'People strategy',
15 start: '10:00',
16 end: '10:30',
17 day: '2027-04-14',
18 dayLabel: 'Wednesday 14 April 2027',
19 room: 'Stage 1 - Main',
20 speakers: 'Ava Example',
21 url: '/events/unleash-miami/agenda-schedule?agendaSession=public',
22 topics: '',
23 format: 'Keynote',
24 keynote: true,
25 track: '',
26 access: '',
27 }
28 const text =
29 stageListingReply('What is on Stage 1?', [
30 session,
31 { ...session, room: 'Stage 10 - Other', title: 'Other talk' },
32 ]) || ''
33 expect(text).toContain('Ava Example')
34 expect(text).toContain('14 April 2027, 10:00–10:30')
35 expect(text).toContain(session.url)
36 expect(text).not.toContain('Other talk')
37 expect(stageListingReply('Build me an agenda', [session])).toBeUndefined()
38 expect(stageListingReply('What is on Stage 2?', [session])).toContain(
39 'can’t confirm',
40 )
41})
42