/* eslint-env jest */ import type { WeeklyReportResponse } from '../../../service/visibility/visibility.interface'; import { FALLBACK_STARTERS, MAX_STARTERS, starterPrompts, } from '../starter-prompts'; const reportWith = (starters: string[] | undefined): WeeklyReportResponse => ({ conversation_starters: starters }) as unknown as WeeklyReportResponse; it('offers the generic questions before the first scan', () => { expect(starterPrompts(null)).toEqual([...FALLBACK_STARTERS]); expect(starterPrompts(reportWith(undefined))).toEqual([...FALLBACK_STARTERS]); expect(starterPrompts(reportWith([' ']))).toEqual([...FALLBACK_STARTERS]); }); it("offers the week's own questions, never mixed with the English ones", () => { expect( starterPrompts(reportWith(['Ce s-a schimbat săptămâna asta?'])) ).toEqual(['Ce s-a schimbat săptămâna asta?']); }); it('keeps the list short', () => { const written = ['One?', 'Two?', 'Three?', 'Four?', 'Five?']; expect(starterPrompts(reportWith(written))).toEqual( written.slice(0, MAX_STARTERS) ); expect(FALLBACK_STARTERS.length).toBeLessThanOrEqual(MAX_STARTERS); });