Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
///
import { videoMachine, audioMachine } from '../../src/machines.js'
import { getSimplePaths, getShortestPaths } from '@xstate/graph'
import { map, compose, pipe, lensPath, view, curry } from 'ramda'
const videoSimplePaths = getSimplePaths(videoMachine)
const audioSimplePaths = getSimplePaths(audioMachine)
const videoShortestPaths = getShortestPaths(videoMachine)
const audioShortestPaths = getShortestPaths(audioMachine)
const videoStateList = Object.keys(videoSimplePaths)
const audioStateList = Object.keys(audioSimplePaths)
const machineName = lensPath(['tree', 'stateNode', 'config', 'id'])
const currentMachine = (state) => view(machineName, state) === 'videoMachine' ? videoMachine : audioMachine
const selectSimpleVideoPaths = (currentState) => videoSimplePaths[currentState].paths[0]
const selectSimpleAudioPaths = (currentState) => audioSimplePaths[currentState].paths[0]
const reload = () => cy.reload()
const appIsReady = () => cy.get('video').should('be.visible')
const changeTab = (newTab) => () => cy.get(`button[id="${newTab}"`).click()
const changeToAudioTab = changeTab('audioTab')
const checkTransition = ({ state, event }) => {
cy.log(`checking transition from ${state.value} due to ${event.type}`)
// if there are paths[x].state.actions[y] then have Hyperapp and XState run the action(s) for us
///
import { videoMachine, audioMachine } from '../../src/machines.js'
import { getSimplePaths, getShortestPaths } from '@xstate/graph'
import { map, compose, pipe, lensPath, view, curry } from 'ramda'
const videoSimplePaths = getSimplePaths(videoMachine)
const audioSimplePaths = getSimplePaths(audioMachine)
const videoShortestPaths = getShortestPaths(videoMachine)
const audioShortestPaths = getShortestPaths(audioMachine)
const videoStateList = Object.keys(videoSimplePaths)
const audioStateList = Object.keys(audioSimplePaths)
const machineName = lensPath(['tree', 'stateNode', 'config', 'id'])
const currentMachine = (state) => view(machineName, state) === 'videoMachine' ? videoMachine : audioMachine
const selectSimpleVideoPaths = (currentState) => videoSimplePaths[currentState].paths[0]
const selectSimpleAudioPaths = (currentState) => audioSimplePaths[currentState].paths[0]
const reload = () => cy.reload()
const appIsReady = () => cy.get('video').should('be.visible')
const changeTab = (newTab) => () => cy.get(`button[id="${newTab}"`).click()
const changeToAudioTab = changeTab('audioTab')
const checkTransition = ({ state, event }) => {
cy.log(`checking transition from ${state.value} due to ${event.type}`)
public getSimplePathPlans(
options?: Partial>
): Array> {
const simplePaths = getSimplePaths(this.machine, {
...options,
events: getEventSamples(this.options.events)
}) as StatePathsMap;
return this.getTestPlans(simplePaths);
}