before functional changes by codex
This commit is contained in:
25
test/basic/scaling-and-output.basic.test.js
Normal file
25
test/basic/scaling-and-output.basic.test.js
Normal 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);
|
||||
});
|
||||
Reference in New Issue
Block a user