mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
Fix schedule-related test mocks for DI refactor and migration changes
This commit is contained in:
1 parent
47524876aa
commit
7d65e20c55
2 files changed
+14
-3
No files matched your search
@@ -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(),
|
||||
}
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in new issue
Block a user