35 lines
966 B
JavaScript
35 lines
966 B
JavaScript
// __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();
|
|
});
|
|
});
|