|
1 | 1 | import { knowledgeConnectorSyncLog } from '@sim/db/schema' |
2 | | -import { |
3 | | - createMockRequest, |
4 | | - dbChainMockFns, |
5 | | - queueTableRows, |
6 | | - resetDbChainMock, |
7 | | - schemaMock, |
8 | | -} from '@sim/testing' |
9 | | -import { authInternalMock } from '@sim/testing/mocks/auth-internal.mock' |
| 2 | +import { dbChainMockFns, queueTableRows, resetDbChainMock, schemaMock } from '@sim/testing' |
10 | 3 | import { storageServiceMock } from '@sim/testing/mocks/storage-service.mock' |
11 | 4 | import { beforeEach, describe, expect, it, vi } from 'vitest' |
12 | 5 |
|
13 | | -vi.mock('@/lib/auth/internal', () => authInternalMock) |
14 | 6 | vi.mock('@/lib/uploads/core/storage-service', () => storageServiceMock) |
15 | 7 |
|
16 | | -import { GET } from '@/app/api/cron/cleanup-stale-executions/route' |
| 8 | +import { runCleanupStaleExecutions } from '@/background/cleanup-stale-executions' |
17 | 9 |
|
18 | 10 | /** Flattens a drizzle condition tree into the values it compares against. */ |
19 | 11 | function collectValues(value: unknown, out: unknown[] = []): unknown[] { |
@@ -71,7 +63,7 @@ describe('connector sync log retention', () => { |
71 | 63 | * behaviour, so the two `exists` guards are load-bearing. |
72 | 64 | */ |
73 | 65 | it('claims only terminal rows that still have a newer sibling', async () => { |
74 | | - await GET(createMockRequest('GET') as never) |
| 66 | + await runCleanupStaleExecutions() |
75 | 67 |
|
76 | 68 | const predicate = syncLogClaimPredicate() |
77 | 69 | // The arm has to actually run, or this asserts nothing. |
|
0 commit comments