feat: make media inspection progressive
This commit is contained in:
@@ -16,6 +16,66 @@ import type { UserExportPreset } from '../../../src/presets';
|
||||
afterEach(cleanup);
|
||||
|
||||
describe('QuickConvert', () => {
|
||||
it('keeps an uninspected source usable and requests stream detection with export', async () => {
|
||||
const user = userEvent.setup();
|
||||
const onInspect = vi.fn();
|
||||
const onExport = vi.fn<(configuration: QuickExportConfiguration) => void>();
|
||||
const file = new File(['media'], 'lecture.mp4', { type: 'video/mp4' });
|
||||
const asset: ImportedMediaAsset = {
|
||||
id: 'asset-basic',
|
||||
file,
|
||||
objectUrl: 'blob:asset-basic',
|
||||
phase: 'idle',
|
||||
browserMetadata: {
|
||||
source: 'browser',
|
||||
file: {
|
||||
name: file.name,
|
||||
sizeBytes: file.size,
|
||||
declaredMimeType: file.type,
|
||||
inferredMimeType: file.type,
|
||||
lastModified: file.lastModified,
|
||||
},
|
||||
kind: 'video',
|
||||
durationSeconds: 2_622.48,
|
||||
width: 640,
|
||||
height: 480,
|
||||
hasVideo: true,
|
||||
},
|
||||
};
|
||||
|
||||
render(
|
||||
<QuickConvert
|
||||
asset={asset}
|
||||
engineState={readyEngine()}
|
||||
busy={false}
|
||||
onInspect={onInspect}
|
||||
onExport={onExport}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText(/43:42\.48/u)).toBeVisible();
|
||||
expect(screen.getByText('Ready to play')).toBeVisible();
|
||||
await user.click(
|
||||
screen.getByRole('button', { name: 'Inspect details now' })
|
||||
);
|
||||
expect(onInspect).toHaveBeenCalledOnce();
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Inspect & convert' }));
|
||||
expect(onExport).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
operation: 'convert',
|
||||
selectDetectedStreams: true,
|
||||
streamSelection: {
|
||||
video: [],
|
||||
audio: [],
|
||||
subtitles: [],
|
||||
attachments: [],
|
||||
data: [],
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('labels a submission honestly when another operation is active', () => {
|
||||
render(
|
||||
<QuickConvert
|
||||
|
||||
Reference in New Issue
Block a user