Skip to content

Commit 875498c

Browse files
waleedlatif1claude
andcommitted
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>
1 parent 3c196d1 commit 875498c

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

apps/sim/app/api/schedules/[id]/route.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ describe('Schedule PUT API (Reactivate)', () => {
100100
})
101101

102102
describe('Request Validation', () => {
103-
it('returns 400 when action is not reactivate', async () => {
103+
it('returns 400 when action is not a valid enum value', async () => {
104104
mockDbChain([
105105
[{ id: 'sched-1', workflowId: 'wf-1', status: 'disabled' }],
106106
[{ userId: 'user-1', workspaceId: null }],
107107
])
108108

109-
const res = await PUT(createRequest({ action: 'disable' }), createParams('sched-1'))
109+
const res = await PUT(createRequest({ action: 'invalid-action' }), createParams('sched-1'))
110110

111111
expect(res.status).toBe(400)
112112
const data = await res.json()

apps/sim/app/api/schedules/execute/route.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ vi.mock('@/lib/core/async-jobs', () => ({
7171
vi.mock('drizzle-orm', () => ({
7272
and: vi.fn((...conditions: unknown[]) => ({ type: 'and', conditions })),
7373
eq: vi.fn((field: unknown, value: unknown) => ({ field, value, type: 'eq' })),
74+
ne: vi.fn((field: unknown, value: unknown) => ({ field, value, type: 'ne' })),
7475
lte: vi.fn((field: unknown, value: unknown) => ({ field, value, type: 'lte' })),
7576
lt: vi.fn((field: unknown, value: unknown) => ({ field, value, type: 'lt' })),
7677
not: vi.fn((condition: unknown) => ({ type: 'not', condition })),
@@ -94,6 +95,7 @@ vi.mock('@sim/db', () => ({
9495
nextRunAt: 'nextRunAt',
9596
lastQueuedAt: 'lastQueuedAt',
9697
deploymentVersionId: 'deploymentVersionId',
98+
sourceType: 'sourceType',
9799
},
98100
workflowDeploymentVersion: {
99101
id: 'id',
@@ -161,7 +163,7 @@ describe('Scheduled Workflow Execution API Route', () => {
161163
})
162164

163165
it('should execute scheduled workflows with Trigger.dev disabled', async () => {
164-
mockDbReturning.mockReturnValue(SINGLE_SCHEDULE)
166+
mockDbReturning.mockReturnValueOnce(SINGLE_SCHEDULE).mockReturnValueOnce([])
165167

166168
const response = await GET(createMockRequest())
167169

@@ -174,7 +176,7 @@ describe('Scheduled Workflow Execution API Route', () => {
174176

175177
it('should queue schedules to Trigger.dev when enabled', async () => {
176178
mockFeatureFlags.isTriggerDevEnabled = true
177-
mockDbReturning.mockReturnValue(SINGLE_SCHEDULE)
179+
mockDbReturning.mockReturnValueOnce(SINGLE_SCHEDULE).mockReturnValueOnce([])
178180

179181
const response = await GET(createMockRequest())
180182

@@ -185,7 +187,7 @@ describe('Scheduled Workflow Execution API Route', () => {
185187
})
186188

187189
it('should handle case with no due schedules', async () => {
188-
mockDbReturning.mockReturnValue([])
190+
mockDbReturning.mockReturnValueOnce([]).mockReturnValueOnce([])
189191

190192
const response = await GET(createMockRequest())
191193

@@ -196,7 +198,7 @@ describe('Scheduled Workflow Execution API Route', () => {
196198
})
197199

198200
it('should execute multiple schedules in parallel', async () => {
199-
mockDbReturning.mockReturnValue(MULTIPLE_SCHEDULES)
201+
mockDbReturning.mockReturnValueOnce(MULTIPLE_SCHEDULES).mockReturnValueOnce([])
200202

201203
const response = await GET(createMockRequest())
202204

apps/sim/blocks/blocks/airtable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ export const AirtableBlock: BlockConfig<AirtableResponse> = {
8888
placeholder: 'Select Airtable table',
8989
dependsOn: ['credential', 'baseSelector'],
9090
mode: 'basic',
91-
condition: { field: 'operation', value: ['listBases', 'listTables'], not: true },
92-
required: { field: 'operation', value: ['listBases', 'listTables'], not: true },
91+
condition: { field: 'operation', value: ['listBases', 'listTables', 'getSchema'], not: true },
92+
required: { field: 'operation', value: ['listBases', 'listTables', 'getSchema'], not: true },
9393
},
9494
{
9595
id: 'tableId',

apps/sim/lib/workflows/migrations/subblock-migrations.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ describe('backfillCanonicalModes', () => {
236236
const input: Record<string, BlockState> = {
237237
b1: makeBlock({
238238
type: 'knowledge',
239-
data: { canonicalModes: { knowledgeBaseId: 'advanced' } },
239+
data: { canonicalModes: { knowledgeBaseId: 'advanced', documentId: 'basic' } },
240240
subBlocks: {
241241
knowledgeBaseSelector: {
242242
id: 'knowledgeBaseSelector',

0 commit comments

Comments
 (0)