How to use the xstate.matchesState function in xstate

To help you get started, we’ve selected a few xstate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ArkEcosystem / core / packages / core-test-utils / lib / matchers / blockchain / transition.js View on Github external
const toTransition = (machine, transition) => {
  const state = machine.transition(transition.from, transition.on)

  return {
    // FIXME isNot is necessary to write the right message
    // @see https://facebook.github.io/jest/docs/en/expect.html#expectextendmatchers
    message: () => `Expected machine to ${this.isNot ? 'not' : ''} transition to "${transition.to}" from "${transition.from}" on "${transition.on}"`,
    pass: matchesState(transition.to, state.value)
  }
}
github ArkEcosystem / core / packages / core-jest-matchers / src / blockchain / transition.ts View on Github external
toTransition: (machine, transition) => {
        const state = machine.transition(transition.from, transition.on);

        return {
            // FIXME isNot is necessary to write the right message
            // @see https://facebook.github.io/jest/docs/en/expect.html#expectextendmatchers
            message: () =>
                `Expected machine to ${this.isNot ? "not" : ""} transition to "${transition.to}" from "${
                    transition.from
                }" on "${transition.on}"`,
            pass: matchesState(transition.to, state.value),
        };
    },
});
github hashicorp / vault / ui / app / components / ui-wizard.js View on Github external
advanceWizard() {
      let inInit = matchesState('init', this.get('wizard.currentState'));
      let event = inInit ? this.get('wizard.initEvent') || 'CONTINUE' : 'CONTINUE';
      this.get('wizard').transitionTutorialMachine(this.get('currentState'), event);
    },
github avaragado / xstateful-react / src / index.jsx View on Github external
is: str => ({ state }) =>
                    !!(state && matchesState(str, state.value)),
                not: str => ({ state }) =>
github avaragado / xstateful-react / src / index.jsx View on Github external
                    !(state && arr.some(str => matchesState(str, state.value))),
            },
github LevelbossMike / ember-statecharts / addon / computed.js View on Github external
return _states.any(state => {
      return xstateMatchesState(state, get(this, `${statechartPropertyName}.currentState.value`));
    });
  });