15 lines
518 B
TypeScript
15 lines
518 B
TypeScript
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
|
import { ShxAutomationContext } from '../ts/index.js';
|
|
|
|
tap.test('registers and runs automation handlers', async () => {
|
|
const context = new ShxAutomationContext({ callerId: 'test' });
|
|
let ran = false;
|
|
context.on({ id: 'manual:test', kind: 'manual', expression: 'test' }, async () => {
|
|
ran = true;
|
|
});
|
|
await context.runTrigger({ triggerId: 'manual:test', kind: 'manual', payload: {} });
|
|
expect(ran).toBeTrue();
|
|
});
|
|
|
|
export default tap.start();
|