mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-26 10:55:27 +00:00
* feat(storage): add archive storage support for assets * fix(webui): show archive icon in front of file name in breadcrumb bar * fix(webui): display archive icon in breadcrumbs when restoring * refactor(transcode): simplify restore asset workflow to single while loop * docs(configuration): add archive storage documentation and readme entries * fix(webui): show archive icon in front of version names and prevent version card overflow * fix(webui): fix overflow in manage versions dialog scroll area * fix(webui): prevent manage versions dialog overflow on long file names * docs(configuration): fix archive storage environment variables and defaults * fix(storage): address code review findings for archive storage
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
// @vitest-environment happy-dom
|
|
import { cleanup, render, screen } from '@testing-library/react'
|
|
import React from 'react'
|
|
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
import { PdfViewer } from './pdf-viewer'
|
|
import type { AssetInfo } from '@shumai/dtos'
|
|
|
|
vi.mock('pdfjs-dist', () => ({
|
|
GlobalWorkerOptions: { workerSrc: '' },
|
|
getDocument: vi.fn(),
|
|
}))
|
|
|
|
describe('PdfViewer', () => {
|
|
afterEach(() => {
|
|
cleanup()
|
|
})
|
|
|
|
it('renders archived placeholder when native PDF is archived and pdfTranscode.url is absent', () => {
|
|
const archivedPdf: AssetInfo = {
|
|
id: 'pdf-1',
|
|
name: 'document.pdf',
|
|
type: 'file',
|
|
status: 'archived',
|
|
sizeByte: 1024,
|
|
fileCount: 0,
|
|
createdAt: '2026-01-01T00:00:00Z',
|
|
updatedAt: '2026-01-01T00:00:00Z',
|
|
media: {
|
|
original: { key: 'files/pdf-1/document.pdf' },
|
|
pdfTranscode: { key: 'files/pdf-1/document.pdf' },
|
|
},
|
|
} as AssetInfo
|
|
|
|
render(<PdfViewer file={archivedPdf} />)
|
|
|
|
expect(screen.getByTestId('pdf-viewer-archived-state')).toBeTruthy()
|
|
})
|
|
})
|