42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const { calculate } = require('../public/calculateAngles.cjs');
|
|
|
|
|
|
|
|
/* -------------------------
|
|
Tests
|
|
------------------------- */
|
|
|
|
describe('calculateAngles.calculate', () => {
|
|
test('berechnet X-Durchschnitt für Base / Arm1 / Joint1', async () => {
|
|
//const markersPath = path.resolve('./test/snapshots/snapshot_video0_1774805028717_two_cam.json');
|
|
const markersPath = path.resolve('./test/snapshots/snapshot_video0_1775406055428_two_cam.json');
|
|
const robotPath = path.resolve('./public/robot.json');
|
|
|
|
const foundMarkers = JSON.parse(fs.readFileSync(markersPath, 'utf8'));
|
|
const jsonRobot = JSON.parse(fs.readFileSync(robotPath, 'utf8'));
|
|
|
|
const result = await calculate(foundMarkers, jsonRobot);
|
|
|
|
expect(result.status).toBe('ok');
|
|
expect(result.result).toBeDefined();
|
|
});
|
|
});
|
|
|
|
|
|
describe('calculateAngles.y', () => {
|
|
test('berechnet y-Durchschnitt für Base / Arm1 / Joint1', async () => {
|
|
const markersPath = path.resolve('./test/snapshots/snapshot_video0_1778407171886_two_cam.json');
|
|
const robotPath = path.resolve('./public/robot.json');
|
|
|
|
const foundMarkers = JSON.parse(fs.readFileSync(markersPath, 'utf8'));
|
|
const jsonRobot = JSON.parse(fs.readFileSync(robotPath, 'utf8'));
|
|
|
|
const result = await calculate(foundMarkers, jsonRobot);
|
|
|
|
expect(result.status).toBe('ok');
|
|
expect(result.result).toBeDefined();
|
|
});
|
|
});
|