Skip to content

Commit

Permalink
Add test for unknown event with microstep inspection events (#4901)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkpiano authored May 19, 2024
1 parent 34ec48c commit d647285
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/core/test/inspect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,4 +1016,20 @@ describe('inspect', () => {
]
`);
});

it('@xstate.microstep inspection events should report no transitions if an unknown event was sent', () => {
const machine = createMachine({});
expect.assertions(1);

const actor = createActor(machine, {
inspect: (ev) => {
if (ev.type === '@xstate.microstep') {
expect(ev._transitions.length).toBe(0);
}
}
});

actor.start();
actor.send({ type: 'any' });
});
});

0 comments on commit d647285

Please sign in to comment.