diff --git a/backend/test/db/schedule-migrations.test.ts b/backend/test/db/schedule-migrations.test.ts index 0d4a467e..435e2dfe 100644 --- a/backend/test/db/schedule-migrations.test.ts +++ b/backend/test/db/schedule-migrations.test.ts @@ -15,8 +15,18 @@ describe('schedule migrations', () => { it('creates tables from scratch when schedule_jobs does not exist (phantom migration)', () => { const db = { - prepare: vi.fn().mockReturnValue({ - get: vi.fn().mockReturnValue(undefined), + prepare: vi.fn().mockImplementation((query: string) => { + if (query.includes('PRAGMA table_info')) { + return { + all: vi.fn().mockReturnValue([ + { name: 'interval_minutes', notnull: 0, dflt_value: null }, + { name: 'schedule_mode', notnull: 1, dflt_value: "'interval'" }, + { name: 'cron_expression', notnull: 0, dflt_value: null }, + { name: 'timezone', notnull: 0, dflt_value: null }, + ]), + } + } + return { get: vi.fn().mockReturnValue(undefined) } }), run: vi.fn(), } diff --git a/backend/test/routes/git.test.ts b/backend/test/routes/git.test.ts index df20570b..0d51d8a8 100644 --- a/backend/test/routes/git.test.ts +++ b/backend/test/routes/git.test.ts @@ -5,6 +5,7 @@ import { getRepoById } from '../../src/db/queries' import type { Database } from 'bun:sqlite' import type { Repo } from '../../../shared/src/types' import type { GitAuthService } from '../../src/services/git-auth' +import type { ScheduleService } from '../../src/services/schedules' vi.mock('bun:sqlite', () => ({ Database: vi.fn(), @@ -58,7 +59,7 @@ describe('Git Routes', () => { mockGitAuthService = { getGitEnvironment: vi.fn().mockReturnValue({}), } as unknown as GitAuthService - app = createRepoRoutes(mockDatabase, mockGitAuthService) + app = createRepoRoutes(mockDatabase, mockGitAuthService, {} as unknown as ScheduleService) }) describe('GET /:id/git/status', () => {