import assert from 'node:assert/strict'; import { preparePublicFile, fileMime } from '../../shine-UI/js/services/file-preparation-service.js'; assert.equal(fileMime(new File(['x'], 'clip.mp4', { type: '' })), 'video/mp4'); assert.equal(fileMime(new File(['x'], 'mystery', { type: '' })), 'application/octet-stream'); for (const size of [1, 16384, 16385, 1048576, 1048577, 2097152]) { const blob = new File([new Uint8Array(size)], 'data.bin'); const prepared = await preparePublicFile(blob); assert.equal(prepared.size, size); assert.match(prepared.pr, /^[A-Za-z0-9_-]{43}$/); assert.equal((await preparePublicFile(blob)).pr, prepared.pr); } console.log('R2 client preparation smoke tests OK');