phone/packages/robot3/test/test-action.js
Corey Johnson 27aa62f950 Upgrade robot3 to 1.3.0 for improved TypeScript support
- 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>
2026-01-21 14:53:11 -08:00

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');
});
});