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:
belviskhoremk
2026-08-12 11:28:05 +02:00
parent ae373cac85
commit 795635b4fa

View File

@@ -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'