26 lines
701 B
JavaScript
26 lines
701 B
JavaScript
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);
|
|
});
|