overhaul gpx creation and usage
Sonarqube Scanner / Prepare environment (push) Successful in 8s
Sonarqube Scanner / Build and test (push) Failing after 22s
Sonarqube Scanner / SonarQube analysis (push) Skipped
Sonarqube Scanner / Deploy to Server (push) Successful in 6s

This commit is contained in:
Florian Zumpe
2026-10-03 12:40:26 +02:00
parent 1cb3977269
commit 171ea88d55
29 changed files with 969 additions and 344 deletions
+22 -1
View File
@@ -1,3 +1,4 @@
import { parseGpx } from '../src/services/gpx.js';
import assert from 'node:assert/strict';
import fs from 'node:fs/promises';
import os from 'node:os';
@@ -209,7 +210,27 @@ assert result['ok'] is True
assert.equal(route.gpxUrl, `/api/routes/${route.id}/gpx`);
const { response: gpxResponse, body: downloadedGpx } = await requestBuffer(`${baseUrl}${route.gpxUrl}`);
assert.match(gpxResponse.headers.get('content-type') || '', /application\/gpx\+xml/);
assert.deepEqual(downloadedGpx, gpx);
assert.match(downloadedGpx.toString(), /<rtept /);
assert.doesNotMatch(downloadedGpx.toString(), /<trkpt /);
assert.deepEqual(parseGpx(downloadedGpx.toString()).points, parseGpx(gpx.toString()).points);
const { body: pendingPoi } = await requestJson(`${baseUrl}/api/routes/${route.id}/pois`, {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: 'Ohne Empfang', lat: null, lon: null })
}, 201);
assert.equal(pendingPoi.lat, null);
assert.equal(pendingPoi.lon, null);
const { body: pendingGpx } = await requestBuffer(`${baseUrl}${route.gpxUrl}`);
assert.match(pendingGpx.toString(), /wegwichtel:pendingWaypoint/);
const { body: locatedPoi } = await requestJson(`${baseUrl}/api/routes/${route.id}/pois/${pendingPoi.id}`, {
method: 'PUT', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ lat: 50, lon: 10 })
});
assert.equal(locatedPoi.lat, 50);
const { body: locatedGpx } = await requestBuffer(`${baseUrl}${route.gpxUrl}`);
assert.doesNotMatch(locatedGpx.toString(), /wegwichtel:pendingWaypoint/);
assert.match(locatedGpx.toString(), /<wpt lat="50" lon="10">/);
await requestJson(`${baseUrl}/api/routes/${route.id}/pois/${pendingPoi.id}`, { method: 'DELETE' });
const { body: poi } = await requestJson(`${baseUrl}/api/routes/${route.id}/pois`, {
method: 'POST',