import { multipartPartSchedule } from '../public/cloud/admin-template-upload.js'; const intentId = '0123456789abcdef0123456789abcdef'; const mib = 1024 ** 2; const schedule = multipartPartSchedule({ intent: { id: intentId, parts: [{ part_number: 1, size_bytes: 64 * mib }], }, part_size_bytes: 64 * mib, part_count: 2, part_urls: [ 'https://objects.example.test/part-1', 'https://objects.example.test/part-2', ], }, intentId, 70 * mib); if (schedule.length !== 2 || schedule[0].completed !== true || schedule[0].size !== 64 * mib || schedule[1].completed !== false || schedule[1].size !== 6 * mib || schedule[1].partNumber !== 2) { throw new Error('Confirmed multipart parts were not safely skipped.'); } for (const invalidParts of [ [{ part_number: 1, size_bytes: 63 * mib }], [{ part_number: 3, size_bytes: 6 * mib }], [ { part_number: 1, size_bytes: 64 * mib }, { part_number: 1, size_bytes: 64 * mib }, ], ]) { try { multipartPartSchedule({ intent: { id: intentId, parts: invalidParts }, part_size_bytes: 64 * mib, part_count: 2, part_urls: [ 'https://objects.example.test/part-1', 'https://objects.example.test/part-2', ], }, intentId, 70 * mib); throw new Error('An invalid server part ledger was accepted.'); } catch (error) { if (!String(error.message).includes('分片账本')) throw error; } } (globalThis.print || console.log)( 'Administrator multipart resume behavior passed.' );