Files
monster/test/basic/constructor.basic.test.js
2026-02-19 17:37:09 +01:00

28 lines
1.2 KiB
JavaScript

const test = require('node:test');
const assert = require('node:assert/strict');
const Monster = require('../../src/specificClass');
const { makeMonsterConfig } = require('../helpers/factories');
test('constructor initializes sampling boundaries and target values', () => {
const monster = new Monster(makeMonsterConfig());
assert.equal(monster.maxVolume, 20);
assert.equal(monster.minPuls, Math.round(monster.minVolume / monster.volume_pulse));
assert.equal(monster.absMaxPuls, Math.round(monster.cap_volume / monster.volume_pulse));
assert.ok(monster.targetPuls > 0);
});
test('output contract contains report tooling fields', () => {
const monster = new Monster(makeMonsterConfig());
const output = monster.getOutput();
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPuls'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3PerPulse'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'm3Total'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulse'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'pulsesRemaining'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaM3'));
assert.ok(Object.prototype.hasOwnProperty.call(output, 'predictedRateM3h'));
});