Jest
Integrating with Jest is simple with @xstate/test
.
import { createTestMachine, createTestModel } from '@xstate/test';
const machine = createTestMachine({
// machine config
});
describe('My app', () => {
createTestModel(machine)
.getPaths()
.forEach((path) => {
it(path.description, async () => {
await path.test({
states: {},
events: {},
});
});
});
});