updates to rotating machine struct
This commit is contained in:
31
test/basic/constructor.basic.test.js
Normal file
31
test/basic/constructor.basic.test.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const Machine = require('../../src/specificClass');
|
||||
const { makeMachineConfig, makeStateConfig } = require('../helpers/factories');
|
||||
|
||||
test('constructor initializes with valid curve model', () => {
|
||||
const machine = new Machine(makeMachineConfig(), makeStateConfig());
|
||||
assert.equal(machine.hasCurve, true);
|
||||
assert.ok(machine.predictFlow);
|
||||
assert.ok(machine.predictPower);
|
||||
assert.ok(machine.predictCtrl);
|
||||
|
||||
const out = machine.getOutput();
|
||||
assert.ok('state' in out);
|
||||
assert.ok('mode' in out);
|
||||
assert.ok('ctrl' in out);
|
||||
});
|
||||
|
||||
test('constructor handles missing curve model without throwing', () => {
|
||||
const cfg = makeMachineConfig({ asset: { supplier: 'x', category: 'machine', type: 'pump', model: 'not-existing-model', unit: 'm3/h' } });
|
||||
const machine = new Machine(cfg, makeStateConfig());
|
||||
|
||||
assert.equal(machine.hasCurve, false);
|
||||
assert.equal(machine.predictFlow, null);
|
||||
assert.equal(machine.predictPower, null);
|
||||
assert.equal(machine.predictCtrl, null);
|
||||
|
||||
const out = machine.getOutput();
|
||||
assert.ok('state' in out);
|
||||
});
|
||||
Reference in New Issue
Block a user