// __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, '../test/fixtures/robot_legacy.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();
  });
});
