- Bundle robot3 1.3.0 locally (not yet published to npm) - Fix remaining type inference issues with `as any` casts for invoke() events Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
21 lines
594 B
JavaScript
21 lines
594 B
JavaScript
import { createMachine, action, interpret, state, transition } from '../machine.js';
|
|
|
|
QUnit.module('Action', () => {
|
|
QUnit.test('Can be used to do side-effects', assert => {
|
|
let count = 0;
|
|
let orig = {};
|
|
let machine = createMachine({
|
|
one: state(
|
|
transition('ping', 'two',
|
|
action(() => count++)
|
|
)
|
|
),
|
|
two: state()
|
|
}, () => orig);
|
|
let service = interpret(machine, () => {});
|
|
service.send('ping');
|
|
|
|
assert.equal(service.context, orig, 'context stays the same');
|
|
assert.equal(count, 1, 'side-effect performed');
|
|
});
|
|
}); |