Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions apps/sim/lib/table/application/groups.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,28 @@ describe('workflow and enrichment Table application commands', () => {
)
})

it('does not start auto-run when the generic update saves a legacy enabled group', async () => {
await updateTableGroupUseCase.execute({
principal,
input: {
tableId: table.id,
workspaceId: table.workspaceId,
groupId: group.id,
autoRun: true,
},
})

expect(mocks.updateGroup).toHaveBeenCalledWith(
expect.objectContaining({
autoRun: true,
suppressAutoRunDispatch: true,
}),
'request-1'
)
expect(mocks.runDetached).not.toHaveBeenCalled()
expect(mocks.runWorkflowColumn).not.toHaveBeenCalled()
})
Comment thread
TheodoreSpeaks marked this conversation as resolved.

it('rejects an invalid output before constructing or mutating the group', async () => {
await expect(
createWorkflowTableGroup.execute({
Expand Down Expand Up @@ -513,6 +535,28 @@ describe('workflow and enrichment Table application commands', () => {
expect(mocks.signal).not.toHaveBeenCalled()
})

it('does not start auto-run when the workflow update saves a legacy enabled group', async () => {
await updateWorkflowTableGroup.execute({
principal,
input: {
tableId: table.id,
workspaceId: table.workspaceId,
groupId: group.id,
autoRun: true,
},
})

expect(mocks.updateGroup).toHaveBeenCalledWith(
expect.objectContaining({
autoRun: true,
suppressAutoRunDispatch: true,
}),
'request-1'
)
expect(mocks.runDetached).not.toHaveBeenCalled()
expect(mocks.runWorkflowColumn).not.toHaveBeenCalled()
})

it('passes authorized output type and ordering to the add-output mutation', async () => {
await addWorkflowTableGroupOutput.execute({
principal,
Expand Down
4 changes: 2 additions & 2 deletions apps/sim/lib/table/application/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ export const updateTableGroupUseCase = defineAuthorizedTableUseCase({
changed:
JSON.stringify(context.table.schema) !== JSON.stringify(table.schema) ||
JSON.stringify(context.table.metadata) !== JSON.stringify(table.metadata),
startAutoRun: previousGroup?.autoRun !== true && input.autoRun === true,
startAutoRun: previousGroup?.autoRun === false && input.autoRun === true,
actorUserId,
}
},
Expand Down Expand Up @@ -824,7 +824,7 @@ export const updateWorkflowTableGroup = defineAuthorizedTableUseCase({
changed:
JSON.stringify(context.table.schema) !== JSON.stringify(table.schema) ||
JSON.stringify(context.table.metadata) !== JSON.stringify(table.metadata),
startAutoRun: previousGroup.autoRun !== true && input.autoRun === true,
startAutoRun: previousGroup.autoRun === false && input.autoRun === true,
actorUserId,
}
},
Expand Down
Loading