fix: resolve post-merge test and lint failures

- airtable: sync tableSelector condition with tableId (add getSchema)
- backfillCanonicalModes test: add documentId mode to prevent false backfill
- schedule PUT test: use invalid action string now that disable is valid
- schedule execute tests: add ne mock, sourceType field, use
  mockReturnValueOnce for two db.update calls
- knowledge tools: fix biome formatting (single-line arrow functions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Waleed Latif
2026-03-07 09:49:57 -08:00
parent 3c196d180f
commit 875498c9aa
4 changed files with 11 additions and 9 deletions

View File

@@ -100,13 +100,13 @@ describe('Schedule PUT API (Reactivate)', () => {
})
describe('Request Validation', () => {
it('returns 400 when action is not reactivate', async () => {
it('returns 400 when action is not a valid enum value', async () => {
mockDbChain([
[{ id: 'sched-1', workflowId: 'wf-1', status: 'disabled' }],
[{ userId: 'user-1', workspaceId: null }],
])
const res = await PUT(createRequest({ action: 'disable' }), createParams('sched-1'))
const res = await PUT(createRequest({ action: 'invalid-action' }), createParams('sched-1'))
expect(res.status).toBe(400)
const data = await res.json()

View File

@@ -71,6 +71,7 @@ vi.mock('@/lib/core/async-jobs', () => ({
vi.mock('drizzle-orm', () => ({
and: vi.fn((...conditions: unknown[]) => ({ type: 'and', conditions })),
eq: vi.fn((field: unknown, value: unknown) => ({ field, value, type: 'eq' })),
ne: vi.fn((field: unknown, value: unknown) => ({ field, value, type: 'ne' })),
lte: vi.fn((field: unknown, value: unknown) => ({ field, value, type: 'lte' })),
lt: vi.fn((field: unknown, value: unknown) => ({ field, value, type: 'lt' })),
not: vi.fn((condition: unknown) => ({ type: 'not', condition })),
@@ -94,6 +95,7 @@ vi.mock('@sim/db', () => ({
nextRunAt: 'nextRunAt',
lastQueuedAt: 'lastQueuedAt',
deploymentVersionId: 'deploymentVersionId',
sourceType: 'sourceType',
},
workflowDeploymentVersion: {
id: 'id',
@@ -161,7 +163,7 @@ describe('Scheduled Workflow Execution API Route', () => {
})
it('should execute scheduled workflows with Trigger.dev disabled', async () => {
mockDbReturning.mockReturnValue(SINGLE_SCHEDULE)
mockDbReturning.mockReturnValueOnce(SINGLE_SCHEDULE).mockReturnValueOnce([])
const response = await GET(createMockRequest())
@@ -174,7 +176,7 @@ describe('Scheduled Workflow Execution API Route', () => {
it('should queue schedules to Trigger.dev when enabled', async () => {
mockFeatureFlags.isTriggerDevEnabled = true
mockDbReturning.mockReturnValue(SINGLE_SCHEDULE)
mockDbReturning.mockReturnValueOnce(SINGLE_SCHEDULE).mockReturnValueOnce([])
const response = await GET(createMockRequest())
@@ -185,7 +187,7 @@ describe('Scheduled Workflow Execution API Route', () => {
})
it('should handle case with no due schedules', async () => {
mockDbReturning.mockReturnValue([])
mockDbReturning.mockReturnValueOnce([]).mockReturnValueOnce([])
const response = await GET(createMockRequest())
@@ -196,7 +198,7 @@ describe('Scheduled Workflow Execution API Route', () => {
})
it('should execute multiple schedules in parallel', async () => {
mockDbReturning.mockReturnValue(MULTIPLE_SCHEDULES)
mockDbReturning.mockReturnValueOnce(MULTIPLE_SCHEDULES).mockReturnValueOnce([])
const response = await GET(createMockRequest())

View File

@@ -88,8 +88,8 @@ export const AirtableBlock: BlockConfig<AirtableResponse> = {
placeholder: 'Select Airtable table',
dependsOn: ['credential', 'baseSelector'],
mode: 'basic',
condition: { field: 'operation', value: ['listBases', 'listTables'], not: true },
required: { field: 'operation', value: ['listBases', 'listTables'], not: true },
condition: { field: 'operation', value: ['listBases', 'listTables', 'getSchema'], not: true },
required: { field: 'operation', value: ['listBases', 'listTables', 'getSchema'], not: true },
},
{
id: 'tableId',

View File

@@ -236,7 +236,7 @@ describe('backfillCanonicalModes', () => {
const input: Record<string, BlockState> = {
b1: makeBlock({
type: 'knowledge',
data: { canonicalModes: { knowledgeBaseId: 'advanced' } },
data: { canonicalModes: { knowledgeBaseId: 'advanced', documentId: 'basic' } },
subBlocks: {
knowledgeBaseSelector: {
id: 'knowledgeBaseSelector',