import { describe, it, expect } from 'vitest' import { processBooking } from '../../skills/calendar-site/template/functions/api/book' // The harness must reach code inside a skill's template/ directory, which is // part of no tsc project. This pins that reach; if it breaks, every template // test below it is unreachable. describe('harness reaches skill template functions', () => { it('imports and runs a template Pages Function against an injected fake D1', async () => { const lines: string[] = [] const fakeDb = { prepare: () => ({ bind() { return this }, run: async () => ({ meta: { changes: 1 } }), }), } const res = await processBooking( { slotStart: '2026-01-01T09:00:00Z', slotEnd: '2026-01-01T09:30:00Z', name: 'harness', email: 'h@e.com', } as never, { DB: fakeDb } as never, (l) => lines.push(l), () => 'fixed-id', ) expect(res.status).toBe(200) expect(lines.join('\n')).toContain('[calendar-booking]') }) })