I'm currently working on testing my react component where I use react-automata. When I run the test it keeps breaking. The goal is to test my Lights component. I'm using the test function from react-automata called "testStateMachine" because I use a statemachine to run the steps of light switching on a button click.
Here is my code example: https://codesandbox.io/s/statemachine-test-sj3w7
This is the test that fails, with error "Cannot read property 'states' of undefined".
import {testStateMachine} from 'react-automata';
import {Lights, lightMachine } from '../Components/Lights';
test('lights with imported components',()=>{
testStateMachine({ lightMachine}, Lights);
});
Best regards Kristine