tests
This commit is contained in:
34
test/calculateAngles3_Calculate_DoubleMarker.test.js
Normal file
34
test/calculateAngles3_Calculate_DoubleMarker.test.js
Normal 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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user