Add queue search and filters, safe upload diagnostics, session report exports, account check visibility, and explicit interrupted-upload recovery.\n\nSanitize diagnostic response snippets in persisted results and rotation logs, protect CSV exports against formula injection, and add regression coverage for diagnostics and reports.
32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
const test = require('node:test');
|
||
const assert = require('node:assert/strict');
|
||
const { buildSessionReport, buildSessionReportCsv } = require('../lib/session-report');
|
||
|
||
test('erstellt einen Hosterbericht mit Erfolgsquote, Dauer, Bytes und Fehlern', () => {
|
||
const report = buildSessionReport({
|
||
id: 'batch-1',
|
||
timestamp: '2026-08-12T12:00:00.000Z',
|
||
files: [{
|
||
name: 'video.mp4',
|
||
size: 1024,
|
||
results: [
|
||
{ hoster: 'byse.sx', status: 'done', durationSec: 4, attempt: 1 },
|
||
{ hoster: 'doodstream.com', status: 'error', durationSec: 3, attempt: 2, error: 'HTTP 503' }
|
||
]
|
||
}]
|
||
});
|
||
|
||
assert.equal(report.totals.total, 2);
|
||
assert.equal(report.totals.succeeded, 1);
|
||
assert.equal(report.hosters['byse.sx'].bytes, 1024);
|
||
assert.equal(report.hosters['doodstream.com'].attempts, 2);
|
||
assert.deepEqual(report.hosters['doodstream.com'].errors, { 'HTTP 503': 1 });
|
||
assert.match(buildSessionReportCsv(report), /doodstream\.com/);
|
||
});
|
||
|
||
test('entschärft Formeln und Geheimnisse im CSV-Bericht', () => {
|
||
const report = buildSessionReport({ files: [{ size: 1, results: [{ hoster: 'byse.sx', status: 'error', error: '=CMD() token=secret' }] }] });
|
||
|
||
assert.match(buildSessionReportCsv(report), /1× =CMD\(\) token=\[redacted\]/);
|
||
});
|