Upload via GUI (85 Dateien)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert');
|
||||
const { describeTransfer } = require('../src/features/transferNotice.js');
|
||||
|
||||
test('Erfolg nennt Repo und Dateizahl', () => {
|
||||
assert.deepStrictEqual(describeTransfer({ status: 'ok', repo: 'a/b', files: 3 }), { title: 'Upload fertig', body: 'a/b: 3 Dateien hochgeladen.' });
|
||||
assert.match(describeTransfer({ status: 'ok', repo: 'a/b', files: 1 }).body, /1 Datei hochgeladen/);
|
||||
});
|
||||
|
||||
test('Erfolg ohne bekannte Dateizahl bleibt lesbar', () => {
|
||||
assert.strictEqual(describeTransfer({ status: 'ok', repo: 'a/b', files: null }).body, 'a/b: Upload hochgeladen.');
|
||||
});
|
||||
|
||||
test('Abgebrochene Uploads melden nichts', () => {
|
||||
assert.strictEqual(describeTransfer({ status: 'abgebrochen', repo: 'a/b' }), null);
|
||||
assert.strictEqual(describeTransfer(null), null);
|
||||
});
|
||||
|
||||
test('Fehler zeigt fehlgeschlagene Dateien oder den Fehlertext', () => {
|
||||
assert.strictEqual(describeTransfer({ status: 'fehler', repo: 'a/b', failed: 2 }).title, 'Upload fehlgeschlagen');
|
||||
assert.match(describeTransfer({ status: 'fehler', repo: 'a/b', failed: 2 }).body, /2 Dateien fehlgeschlagen/);
|
||||
assert.match(describeTransfer({ status: 'fehler', repo: 'a/b', error: 'Server nicht erreichbar' }).body, /Server nicht erreichbar/);
|
||||
assert.match(describeTransfer({ status: 'fehler', repo: '' }).body, /Unbekannter Fehler/);
|
||||
});
|
||||
|
||||
test('Langer Fehlertext wird gekürzt', () => {
|
||||
assert.ok(describeTransfer({ status: 'fehler', repo: 'a/b', error: 'x'.repeat(500) }).body.length < 200);
|
||||
});
|
||||
Reference in New Issue
Block a user