AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { WebsocketClientEvent } from '@activepieces/shared'
import { vi } from 'vitest'
import { websocketService } from '../../src/app/core/websockets.service'
function capture(): DraftPush[] {
const pushes: DraftPush[] = []
observe((push) => {
pushes.push(push)
})
return pushes
}
function observe(onPush: (push: DraftPush) => void): void {
const realTo = websocketService.to
vi.spyOn(websocketService, 'to').mockImplementation((room) => {
const operator = realTo(room)
vi.spyOn(operator, 'emit').mockImplementation((event, ...args) => {
if (event === WebsocketClientEvent.FLOW_DRAFT_UPDATED) {
onPush({ room, payload: args[0] })
}
return true
})
return operator
})
}
export const draftPushes = { capture, observe }
export type DraftPush = {
room: string
payload: unknown
}