23 lines
858 B
JavaScript
23 lines
858 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 updates controller position in operational state', async () => {
|
|
const machine = new Machine(makeMachineConfig(), makeStateConfig({ state: { current: 'operational' } }));
|
|
|
|
await machine.handleInput('parent', 'execMovement', 10);
|
|
|
|
const pos = machine.state.getCurrentPosition();
|
|
assert.ok(pos >= 9.9 && pos <= 10);
|
|
});
|