before functional changes by codex

This commit is contained in:
znetsixe
2026-02-19 17:37:21 +01:00
parent f979b1ae2b
commit 9e0e3e3859
18 changed files with 747 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const { makeMeasurementInstance } = require('../helpers/factories');
test('calculateInput applies scaling and updates bounded output', () => {
const m = makeMeasurementInstance();
m.calculateInput(50);
const out = m.getOutput();
assert.equal(out.mAbs >= 0 && out.mAbs <= 10, true);
assert.equal(out.mPercent >= 0 && out.mPercent <= 100, true);
});
test('out-of-range input is constrained to abs range', () => {
const m = makeMeasurementInstance({
smoothing: { smoothWindow: 1, smoothMethod: 'none' },
});
m.calculateInput(10000);
const out = m.getOutput();
assert.equal(out.mAbs, 10);
});