/** * @jest-environment jsdom */ const fs = require("fs"); const path = require("path"); describe("calculate() row223 Ellbow-Rotation Tests", () => { let calculate; let optimizeRobot; beforeEach(() => { // DOM erzeugen document.body.innerHTML = ``; // Fetch mocken - wird pro Test konfiguriert global.fetch = jest.fn(); // Modul erst JETZT laden (DOM existiert) ({ calculate, optimizeRobot} = require("../public/calculateAngles.js")); }); test('berechnet X-Durchschnitt für Base / Arm1 / Joint1', async () => { const markersPath1 = path.resolve('./test/snapshots/snapshot_video0_1778406635059_two_cam.json'); const markersPath2 = path.resolve('./test/snapshots/snapshot_video0_1778406621349_two_cam.json'); const markersPath3 = path.resolve('./test/snapshots/snapshot_video0_1778407153025_two_cam.json'); const markersPath4 = path.resolve('./test/snapshots/snapshot_video0_1778407171886_two_cam.json'); const robotPath = path.resolve('./public/robot.json'); const foundMarkers1 = JSON.parse(fs.readFileSync(markersPath1, 'utf8')); const foundMarkers2 = JSON.parse(fs.readFileSync(markersPath2, 'utf8')); const foundMarkers3 = JSON.parse(fs.readFileSync(markersPath3, 'utf8')); const foundMarkers4 = JSON.parse(fs.readFileSync(markersPath4, 'utf8')); const list=[foundMarkers1, foundMarkers2, foundMarkers3, foundMarkers4]; const jsonRobot = JSON.parse(fs.readFileSync(robotPath, 'utf8')); const result = await optimizeRobot(list, jsonRobot); expect(result.status).toBe('ok'); expect(result.result).toBeDefined(); }); });