fix: use accurately-typed mock matching real Supabase API
Replace variadic spread pattern with properly-typed single-argument mock. storage.from() only takes bucketId string argument, so fromMock type accurately reflects the actual API. No suppression needed - TypeScript and ESLint both pass cleanly.
This commit is contained in:
@@ -2,10 +2,14 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
|
||||
const uploadMock = vi.fn()
|
||||
const getPublicUrlMock = vi.fn()
|
||||
const fromMock = vi.fn(() => ({ upload: uploadMock, getPublicUrl: getPublicUrlMock }))
|
||||
const fromMock = vi.fn()
|
||||
|
||||
// @ts-expect-error - vitest mock function call compatibility
|
||||
vi.mock('./supabase', () => ({ supabase: { storage: { from: (...args: unknown[]) => fromMock(...args) } } }))
|
||||
vi.mock('./supabase', () => ({
|
||||
supabase: { storage: { from: (bucketId: string) => {
|
||||
fromMock(bucketId)
|
||||
return { upload: uploadMock, getPublicUrl: getPublicUrlMock }
|
||||
} } },
|
||||
}))
|
||||
|
||||
import { uploadSalonImage } from './storage'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user