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(