import { beforeEach, describe, expect, mock, test } from 'bun:test' const apiRequest = mock(async (_endpoint: string): Promise => []) void mock.module('./common.ts', () => ({ apiRequest })) describe('prompts', () => { beforeEach(() => { apiRequest.mockClear() }) test('lists every prompt when no filter is given', async () => { const { listPrompts } = await import('./prompts.ts') await listPrompts() expect(apiRequest.mock.calls[0]![0]).toBe('/prompt') }) test('lists only personal drafts', async () => { const { listPrompts } = await import('./prompts.ts') await listPrompts({ personal: true }) expect(apiRequest.mock.calls[0]![0]).toBe('/prompt?personal=true') }) test('rejects the contradictory projectId + personal combination', async () => { const { listPrompts } = await import('./prompts.ts') await expect(listPrompts({ projectId: 'project-id', personal: true })) .rejects.toThrow('mutually exclusive') expect(apiRequest).not.toHaveBeenCalled() }) test('keeps the project filter separate from the personal filter', async () => { const { listPrompts } = await import('./prompts.ts') await listPrompts({ projectId: 'project-id', includePromotedVersion: true }) expect(apiRequest.mock.calls[0]![0]).toBe('/prompt?projectId=project-id&includePromotedVersion=true') }) })