Files
sim/apps/sim/vitest.setup.ts
T
78b5ae7b3d v0.2.7: fix + feat (#615)
* feat(logging): add additional logs for proxy routes

* fix(blocks): workflow handler not working outside gui (#609)

* fix: key to call api internally for workflow block

* feat: use jwt for internal auth to avoid a static key

* chore: formatter

* fix(sidebar): added loop & parallel subblcoks to sidebar search

* merged improvement/connection into staging (#604)

* merged improvement/connection into staging

* fix: merge conflicts and improved block path calculation

* fix: removed migration

* fix: removed duplicate call

* fix: resolver and merge conflicts

* fix: knowledge base folder

* fix: settings modal

* fix: typeform block

* fix: parallel handler

* fix: stores index

* fix: tests

* fix: tag-dropdown

* improvement: start block input and tag dropdown

* fix block id resolution + missing bracket

* fix lint

* fix test

* works

* fix

* fix lint

* Revert "fix lint"

This reverts commit 433e2f9cfc.

---------

Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-MacBook-Air.local>

* fix(autopan): migration missing (#614)

* add autopan migration

* fix lint

* fix linter

* fix tests

---------

Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@vikhyaths-air.lan>

---------

Co-authored-by: Waleed Latif <walif6@gmail.com>
Co-authored-by: Aditya Tripathi <aditya@climactic.co>
Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@Vikhyaths-MacBook-Air.local>
Co-authored-by: Vikhyath Mondreti <vikhyathmondreti@vikhyaths-air.lan>
2025-07-04 13:48:17 -07:00

77 lines
1.7 KiB
TypeScript

import { afterAll, vi } from 'vitest'
import '@testing-library/jest-dom/vitest'
global.fetch = vi.fn(() =>
Promise.resolve({
ok: true,
json: () => Promise.resolve({}),
})
) as any
vi.mock('@/lib/logs/console-logger', () => {
const createLogger = vi.fn(() => ({
debug: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
fatal: vi.fn(),
}))
return { createLogger }
})
vi.mock('@/stores/console/store', () => ({
useConsoleStore: {
getState: vi.fn().mockReturnValue({
addConsole: 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(() => ({})),
}))
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
})