mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-07 21:25:38 -05:00
* feat(deployed-form): added deployed form input * styling consolidation, finishing touches on form * updated docs * remove unused files with knip * added more form fields * consolidated more test utils * remove unused/unneeded zustand stores, refactored stores for consistency * improvement(files): uncolorized plan name * feat(emcn): button-group * feat(emcn): tag input, tooltip shortcut * improvement(emcn): modal padding, api, chat, form * fix: deleted migrations * feat(form): added migrations * fix(emcn): tag input * fix: failing tests on build * add suplementary hover and fix bg color in date picker * fix: build errors --------- Co-authored-by: Emir Karabeg <emirkarabeg@berkeley.edu>
92 lines
2.1 KiB
TypeScript
92 lines
2.1 KiB
TypeScript
import {
|
|
drizzleOrmMock,
|
|
loggerMock,
|
|
setupGlobalFetchMock,
|
|
setupGlobalStorageMocks,
|
|
} from '@sim/testing'
|
|
import { afterAll, vi } from 'vitest'
|
|
import '@testing-library/jest-dom/vitest'
|
|
|
|
setupGlobalFetchMock()
|
|
setupGlobalStorageMocks()
|
|
|
|
vi.mock('drizzle-orm', () => drizzleOrmMock)
|
|
vi.mock('@sim/logger', () => loggerMock)
|
|
|
|
vi.mock('@/stores/console/store', () => ({
|
|
useConsoleStore: {
|
|
getState: vi.fn().mockReturnValue({
|
|
addConsole: vi.fn(),
|
|
}),
|
|
},
|
|
}))
|
|
|
|
vi.mock('@/stores/terminal', () => ({
|
|
useTerminalConsoleStore: {
|
|
getState: vi.fn().mockReturnValue({
|
|
addConsole: vi.fn(),
|
|
updateConsole: vi.fn(),
|
|
}),
|
|
},
|
|
}))
|
|
|
|
vi.mock('@/stores/execution/store', () => ({
|
|
useExecutionStore: {
|
|
getState: vi.fn().mockReturnValue({
|
|
setIsExecuting: vi.fn(),
|
|
setIsDebugging: vi.fn(),
|
|
setPendingBlocks: vi.fn(),
|
|
reset: vi.fn(),
|
|
setActiveBlocks: vi.fn(),
|
|
}),
|
|
},
|
|
}))
|
|
|
|
vi.mock('@/blocks/registry', () => ({
|
|
getBlock: vi.fn(() => ({
|
|
name: 'Mock Block',
|
|
description: 'Mock block description',
|
|
icon: () => null,
|
|
subBlocks: [],
|
|
outputs: {},
|
|
})),
|
|
getAllBlocks: vi.fn(() => ({})),
|
|
}))
|
|
|
|
vi.mock('@trigger.dev/sdk', () => ({
|
|
task: vi.fn(() => ({ trigger: vi.fn() })),
|
|
tasks: {
|
|
trigger: vi.fn().mockResolvedValue({ id: 'mock-task-id' }),
|
|
batchTrigger: vi.fn().mockResolvedValue([{ id: 'mock-task-id' }]),
|
|
},
|
|
runs: {
|
|
retrieve: vi.fn().mockResolvedValue({ id: 'mock-run-id', status: 'COMPLETED' }),
|
|
},
|
|
configure: vi.fn(),
|
|
}))
|
|
|
|
const originalConsoleError = console.error
|
|
const originalConsoleWarn = console.warn
|
|
|
|
console.error = (...args: any[]) => {
|
|
if (args[0] === 'Workflow execution failed:' && args[1]?.message === 'Test error') {
|
|
return
|
|
}
|
|
if (typeof args[0] === 'string' && args[0].includes('[zustand persist middleware]')) {
|
|
return
|
|
}
|
|
originalConsoleError(...args)
|
|
}
|
|
|
|
console.warn = (...args: any[]) => {
|
|
if (typeof args[0] === 'string' && args[0].includes('[zustand persist middleware]')) {
|
|
return
|
|
}
|
|
originalConsoleWarn(...args)
|
|
}
|
|
|
|
afterAll(() => {
|
|
console.error = originalConsoleError
|
|
console.warn = originalConsoleWarn
|
|
})
|