From 41384f8750fbff87f4ab9d52cac1ef187d76ad63 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 29 Sep 2026 09:37:38 +0000 Subject: [PATCH] test(storage): type the file explorer row fixtures instead of casting to any One typed factory replaces five casts, so a row fixture can no longer drift from the prop it stands in for. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01N3euXsz25sTybsGTcxCFfn --- .../StorageExplorer/FileExplorerRow.test.tsx | 64 +++++++++---------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerRow.test.tsx b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerRow.test.tsx index 9190bfd5063..714de3d311f 100644 --- a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerRow.test.tsx +++ b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerRow.test.tsx @@ -7,6 +7,10 @@ import { STORAGE_ROW_TYPES, STORAGE_VIEWS, } from '@/components/interfaces/Storage/Storage.constants' +import type { + StorageItem, + StorageItemMetadata, +} from '@/components/interfaces/Storage/Storage.types' import { FileExplorerRow } from '@/components/interfaces/Storage/StorageExplorer/FileExplorerRow' import { customRender as render } from '@/tests/lib/custom-render' @@ -41,21 +45,35 @@ vi.mock('@/components/interfaces/Storage/StorageExplorer/useCopyUrl', () => ({ useCopyUrl: () => ({ onCopyUrl: vi.fn() }), })) -const base = { +const METADATA: StorageItemMetadata = { + cacheControl: 'max-age=3600', + contentLength: 10, + size: 10, + httpStatusCode: 200, + eTag: 'etag', + lastModified: '2024-01-01T00:00:00Z', + mimetype: 'image/png', +} + +const item = (overrides: Partial): StorageItem => ({ + id: null, + name: 'photo.png', + type: STORAGE_ROW_TYPES.FILE, status: STORAGE_ROW_STATUS.READY, - metadata: { size: 10, mimetype: 'image/png' }, + metadata: METADATA, isCorrupted: false, created_at: null, updated_at: null, last_accessed_at: null, path: 'photo.png', -} + ...overrides, +}) describe('FileExplorerRow', () => { it('offers both the relative path and the dashboard URL for a file', async () => { render( { it('offers both the relative path and the dashboard URL for a folder', async () => { render( { it('marks an archived file with an icon in the leading slot rather than a text badge', async () => { const { container } = render( { it('gives an archived folder the same actions, since its contents are what they act on', async () => { render( { it('keeps hiding the icon on hover for a live file, which does swap in a checkbox', () => { const { container } = render(