minor optimization
Sonarqube Scanner / Build and analyze (push) Successful in 1m4s

This commit is contained in:
Florian Zumpe
2026-09-02 01:12:50 +02:00
parent be9df67e18
commit bdc0aabc07
8 changed files with 95 additions and 37 deletions
+13 -1
View File
@@ -17,6 +17,8 @@ test('route editor entry point, dialog and forms are present', async () => {
assert.match(html, /id="editor-button"/);
assert.match(html, /aria-label="Streckeneditor öffnen"/);
assert.match(html, /aria-haspopup="dialog"/);
assert.match(html, /aria-controls="editor-dialog"/);
assert.match(html, /<dialog id="editor-dialog"/);
assert.match(html, /<output id="editor-status" class="editor-status" aria-live="polite" hidden><\/output>/);
assert.doesNotMatch(html, /id="editor-status"[^>]*role="status"/);
@@ -54,6 +56,8 @@ test('route editor supports route creation, route editing, POI sorting and POI m
assert.match(ui, /readJson\(`\/routes\/\$\{encodeURIComponent\(id\)\}`\)/);
assert.match(ui, /const method = id \? 'PUT' : 'POST'/);
assert.match(ui, /const method = currentPoiId \? 'PUT' : 'POST'/);
assert.doesNotMatch(ui, /activated_at', ''/);
assert.doesNotMatch(ui, /activatedAt: null/);
assert.match(ui, /move-poi-up/);
assert.match(ui, /move-poi-down/);
assert.match(ui, /sortOrder: index/);
@@ -252,6 +256,7 @@ test('route editor workflow is executable with draft routes and media uploads',
await context.Wegwichtel.EditorUi.open();
assert.equal(elements.get('editor-dialog').open, true);
assert.equal(elements.get('editor-button').attributes.get('aria-expanded'), 'true');
assert.equal(elements.get('editor-route-list-view').hidden, false);
assert.equal(elements.get('editor-route-detail-view').hidden, true);
assert.equal(elements.get('editor-route-list').children.length, 1);
@@ -290,6 +295,7 @@ test('route editor workflow is executable with draft routes and media uploads',
context.Wegwichtel.EditorUi.close();
assert.equal(elements.get('editor-dialog').open, false);
assert.equal(elements.get('editor-button').attributes.get('aria-expanded'), 'false');
});
@@ -310,9 +316,12 @@ test('route editor test hooks cover fallback payloads, errors and form branches'
const unnamedRoute = hooks.routeItem({ id: 5 });
assert.equal(unnamedRoute.dataset.routeId, '5');
assert.equal(unnamedRoute.children[0].children[0].textContent, 'Unbenannte Strecke');
hooks.state.pois = [{ id: 6 }, { id: 7 }];
const unnamedPoi = hooks.poiItem({ id: 6 }, 0);
assert.equal(unnamedPoi.dataset.poiId, '6');
assert.equal(unnamedPoi.children[0].children[0].textContent, 'Unbenannte Station');
assert.equal(unnamedPoi.children[1].children[0].disabled, true);
assert.equal(unnamedPoi.children[1].children[1].disabled, false);
hooks.setStatus('Fehler', true);
assert.equal(elements.get('editor-status').hidden, false);
@@ -331,9 +340,12 @@ test('route editor test hooks cover fallback payloads, errors and form branches'
elements.get('editor-route-id').value = '1';
elements.get('editor-route-name').value = 'Waldweg geändert';
elements.get('editor-route-description').value = 'Mit GPX';
assert.deepEqual(Object.keys(hooks.routeFromForm()).sort(), ['description', 'name']);
elements.get('editor-route-gpx').files = [{ name: 'route.gpx' }];
await hooks.saveRoute();
assert.ok(calls.some(call => call.method === 'PUT' && call.url === '/api/routes/1' && call.body instanceof FakeFormData));
const gpxUpdate = calls.find(call => call.method === 'PUT' && call.url === '/api/routes/1' && call.body instanceof FakeFormData);
assert.ok(gpxUpdate);
assert.equal(gpxUpdate.body.entries.some(([name]) => name === 'activated_at'), false);
elements.get('editor-poi-id').value = '10';
elements.get('editor-poi-title').value = 'Start bearbeitet';