initial commit

This commit is contained in:
Florian Zumpe
2026-06-16 10:31:41 +02:00
parent e607876d37
commit eb559b16fb
282 changed files with 3118 additions and 41422 deletions
+9
View File
@@ -0,0 +1,9 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { distanceMeters, routeMetrics } from '../src/services/geo.js';
test('distanceMeters liefert für identische Punkte 0', () => assert.equal(distanceMeters({ lat: 1, lon: 2 }, { lat: 1, lon: 2 }), 0));
test('routeMetrics berechnet Strecke und Höhengewinn', () => {
const metrics = routeMetrics([{ lat: 52, lon: 13, elevation: 10 }, { lat: 52.001, lon: 13, elevation: 15 }]);
assert.ok(metrics.distanceM > 100); assert.equal(metrics.elevationGainM, 5); assert.equal(metrics.pointCount, 2);
});
+9
View File
@@ -0,0 +1,9 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import { parseGpx } from '../src/services/gpx.js';
test('parseGpx liest Beispielstrecke', () => {
const parsed = parseGpx(fs.readFileSync(new URL('../examples/sample-route.gpx', import.meta.url), 'utf8'));
assert.equal(parsed.name, 'Beispielweg'); assert.equal(parsed.points.length, 3); assert.ok(parsed.metrics.distanceM > 0);
});
+24
View File
@@ -0,0 +1,24 @@
import assert from 'node:assert/strict';
import fs from 'node:fs/promises';
import path from 'node:path';
import test from 'node:test';
const root = path.resolve(import.meta.dirname, '..');
async function read(relativePath) {
return fs.readFile(path.join(root, relativePath), 'utf8');
}
test('default server socket is the Atlas loopback endpoint', async () => {
const configSource = await read('src/config.js');
const envExample = await read('.env.example');
const serverSource = await read('server.js');
assert.match(configSource, /process\.env\.HOST \|\| '127\.0\.0\.1'/);
assert.match(configSource, /process\.env\.PORT \|\| '47145'/);
assert.match(configSource, /process\.env\.INSTANCE_NAME \|\| 'Atlas'/);
assert.match(envExample, /^HOST=127\.0\.0\.1$/m);
assert.match(envExample, /^PORT=47145$/m);
assert.match(envExample, /^INSTANCE_NAME=Atlas$/m);
assert.match(serverSource, /config\.instanceName/);
});
+37
View File
@@ -0,0 +1,37 @@
import assert from 'node:assert/strict';
import fs from 'node:fs/promises';
import path from 'node:path';
import test from 'node:test';
const root = path.resolve(import.meta.dirname, '..');
async function read(relativePath) {
return fs.readFile(path.join(root, relativePath), 'utf8');
}
test('current local jQuery and jQuery UI distributions are present', async () => {
const jquery = await read('public/vendor/jquery/jquery-4.0.0.min.js');
const jqueryUi = await read('public/vendor/jquery-ui/jquery-ui-1.14.2.min.js');
const jqueryUiCss = await read('public/vendor/jquery-ui/jquery-ui-1.14.2.min.css');
assert.match(jquery, /jQuery v4\.0\.0/);
assert.match(jqueryUi, /jQuery UI - v1\.14\.2/);
assert.match(jqueryUiCss, /jQuery UI - v1\.14\.2/);
});
test('jQuery UI base theme image resources are vendored', async () => {
const images = await fs.readdir(path.join(root, 'public/vendor/jquery-ui/images'));
assert.ok(images.includes('ui-icons_444444_256x240.png'));
assert.ok(images.includes('ui-icons_ffffff_256x240.png'));
});
test('client no longer references jQuery Mobile', async () => {
const files = [
'public/index.html',
'public/js/bootstrap-loader.js',
'public/js/app.js',
'public/css/app.css'
];
const content = (await Promise.all(files.map(read))).join('\n');
assert.doesNotMatch(content, /jquery[.-]?mobile|jQuery Mobile|\$\.mobile|data-role=/i);
});