This commit is contained in:
chk
2026-05-20 22:44:15 +02:00
parent 8410ce685b
commit c8a4787bb3
5 changed files with 1249 additions and 1840 deletions

View File

@@ -0,0 +1,34 @@
// __tests__/calculateAngles.test.js
const fs = require('fs');
const path = require('path');
const { calculate } = require('../public/calculateAngles');
describe('calculateAngles minimal test', () => {
it('should run calculate() with loaded JSON files', async () => {
// Pfade auflösen
const robotPath = path.resolve(__dirname, '../public/robot.json');
const snapshotPath = path.resolve(
__dirname,
'../test/snapshots/snapshot_video0_1778845508432_two_cam.json'
);
// JSON laden
var f = fs.readFileSync(robotPath, 'utf-8').replace(/^\uFEFF/, "").trim();
var jsonRobot = null;
try{
jsonRobot = JSON.parse(f);
}
catch(e){
console.log(e)
}
const foundMarkers = JSON.parse(fs.readFileSync(snapshotPath, 'utf-8'));
// Funktion aufrufen
const result = await calculate(foundMarkers, jsonRobot);
// Minimal Assertion: Ergebnis existiert
expect(result).toBeDefined();
});
});