Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
}
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),
};
},
});
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);
},
is: str => ({ state }) =>
!!(state && matchesState(str, state.value)),
not: str => ({ state }) =>
!(state && arr.some(str => matchesState(str, state.value))),
},
return _states.any(state => {
return xstateMatchesState(state, get(this, `${statechartPropertyName}.currentState.value`));
});
});