mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 13:19:09 +03:00
fix: resolve type errors from vitest 4 Mock type changes
vi.fn() now returns Mock<Procedure | Constructable> in vitest 4, which isn't directly callable or assignable to typed function signatures. Fix by narrowing the mock type where it's called directly, and casting at the assignment site for global.fetch.
This commit is contained in:
1 parent
1d4520a832
commit
3362015076
2 files changed
+2
-2
No files matched your search
@@ -108,7 +108,7 @@ vi.mock(import('@/lib/breadcrumbs'), async (importOriginal) => {
|
||||
|
||||
let createSupportStorageClientMock: ReturnType<typeof vi.fn>
|
||||
let getBreadcrumbSnapshotMock: ReturnType<typeof vi.fn>
|
||||
let generateAttachmentUrlSpy: ReturnType<typeof vi.fn>
|
||||
let generateAttachmentUrlSpy: ReturnType<typeof vi.fn<(...args: any[]) => any>>
|
||||
|
||||
// Mock sonner toast
|
||||
vi.mock('sonner', () => ({
|
||||
|
||||
@@ -14,7 +14,7 @@ describe('ai/tools/incident-tools', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mockFetch = vi.fn()
|
||||
global.fetch = mockFetch
|
||||
global.fetch = mockFetch as typeof fetch
|
||||
|
||||
// Mock AbortSignal.timeout
|
||||
mockAbortSignal = new AbortController().signal
|
||||
|
||||
Reference in new issue
Block a user