25 lines
941 B
JavaScript
25 lines
941 B
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
|
|
const Machine = require('../../src/specificClass');
|
|
const { makeMachineConfig, makeStateConfig } = require('../helpers/factories');
|
|
|
|
test('execSequence startup reaches operational with zero transition times', async () => {
|
|
const machine = new Machine(makeMachineConfig(), makeStateConfig());
|
|
|
|
await machine.handleInput('parent', 'execSequence', 'startup');
|
|
|
|
assert.equal(machine.state.getCurrentState(), 'operational');
|
|
});
|
|
|
|
test('execMovement constrains controller position to safe bounds in operational state', async () => {
|
|
const machine = new Machine(makeMachineConfig(), makeStateConfig({ state: { current: 'operational' } }));
|
|
const { max } = machine._resolveSetpointBounds();
|
|
|
|
await machine.handleInput('parent', 'execMovement', 10);
|
|
|
|
const pos = machine.state.getCurrentPosition();
|
|
assert.ok(pos <= max);
|
|
assert.equal(pos, max);
|
|
});
|