Skip to content

Commit d974ede

Browse files
committed
fix(workflows): scope custom block schemas during authoring
1 parent 6585682 commit d974ede

6 files changed

Lines changed: 881 additions & 473 deletions

File tree

‎apps/sim/lib/workflows/application/apply-workflow-operations.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const mocks = vi.hoisted(() => ({
1818
normalizeState: vi.fn(),
1919
sandboxAccess: vi.fn(),
2020
blockVisibility: vi.fn(),
21+
customBlocks: vi.fn(),
2122
permissionConfig: vi.fn(),
2223
preValidate: vi.fn(),
2324
collectReferences: vi.fn(),
@@ -46,6 +47,9 @@ vi.mock('@sim/platform-authz/workspace', () => ({
4647
vi.mock('@/lib/workflows/application/context', () => ({
4748
resolveActiveWorkflowApplicationContext: mocks.resolveContext,
4849
}))
50+
vi.mock('@/lib/workflows/custom-blocks/operations', () => ({
51+
listCustomBlocksWithInputsForWorkspace: mocks.customBlocks,
52+
}))
4953
vi.mock('@/lib/realtime/notify', () => ({ notifyWorkflowUpdated: mocks.notify }))
5054
vi.mock('@/lib/workflows/persistence/replace-normalized-state', () => ({
5155
replaceWorkflowNormalizedState: mocks.replace,
@@ -179,6 +183,7 @@ const EMPTY_GRAPH_LINT = {
179183
describe('applyWorkflowOperations', () => {
180184
beforeEach(() => {
181185
vi.clearAllMocks()
186+
mocks.customBlocks.mockResolvedValue([])
182187
mocks.resolveContext.mockResolvedValue(context)
183188
mocks.resolvePermission.mockResolvedValue('write')
184189
workflowAuthzMockFns.mockAssertWorkflowMutable.mockResolvedValue(undefined)
@@ -542,6 +547,7 @@ describe('applyWorkflowOperations', () => {
542547
expect(mocks.applyOperations).toHaveBeenCalledWith(baseGraph, operations, null, true)
543548

544549
vi.clearAllMocks()
550+
mocks.customBlocks.mockResolvedValue([])
545551
mocks.resolveContext.mockResolvedValue(context)
546552
mocks.resolvePermission.mockResolvedValue('write')
547553
mocks.sandboxAccess.mockResolvedValue(true)

0 commit comments

Comments
 (0)