MCPcopy
hub / github.com/statelyai/xstate / createSampleMachine

Function createSampleMachine

packages/xstate-react/test/useActorRef.test.tsx:703–721  ·  view source on GitHub ↗
(counter: number)

Source from the content-addressed store, hash-verified

701 const spy = vi.fn();
702
703 const createSampleMachine = (counter: number) => {
704 const child = createMachine({
705 on: {
706 EV: {
707 actions: () => {
708 spy(counter);
709 }
710 }
711 }
712 });
713
714 return createMachine({
715 context: ({ spawn }) => {
716 return {
717 childRef: spawn(child)
718 };
719 }
720 });
721 };
722
723 const machine1 = createSampleMachine(1);
724 const machine2 = createSampleMachine(2);

Callers 1

Calls 1

createMachineFunction · 0.85

Tested by

no test coverage detected