Created
April 21, 2021 02:16
-
-
Save jf423/523429893f75ff703e8dd25f4a639c65 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const walletMachine = Machine({ | |
id: 'Wallet', | |
initial: 'default', | |
states: { | |
default: { | |
initial: 'initial', | |
states: { | |
initial: { | |
meta: { | |
test: ({ getByTestId }) => { | |
expect(getByTestId(WALLET_TOTAL_CURRENCY.ID)).toBeInTheDocument() | |
expect(getByTestId(WALLET_CASHOUT_BUTTON.ID)).toBeInTheDocument() | |
expect(getByTestId(WALLET_WEEK_CURRENCY.ID)).toBeInTheDocument() | |
expect(getByTestId(WALLET_AMOUNT_CURRENCY.ID)).toBeInTheDocument() | |
expect(getByTestId(WALLET_CONTACT.ID)).toBeInTheDocument() | |
}, | |
}, | |
}, | |
cashOut: { | |
meta: { | |
test: () => { | |
expect(onCashOut).toBeCalled() | |
}, | |
}, | |
}, | |
}, | |
on: { | |
CLICK_CASH_OUT: 'default.cashOut', | |
RERENDER_EMPTY: 'empty', | |
}, | |
meta: { | |
test: ({ getByTestId }) => { | |
expect(getByTestId(WALLET_CONTAINER.ID)).toBeInTheDocument() | |
}, | |
}, | |
}, | |
empty: { | |
on: { | |
RERENDER_SUCCESS: 'success', | |
}, | |
meta: { | |
test: ({ getByTestId }) => { | |
expect(getByTestId(WALLET_CONTAINER.ID)).toBeInTheDocument() | |
expect(getByTestId(WALLET_CASHOUT_BUTTON.ID)).toBeInTheDocument() | |
expect(getByTestId(WALLET_CONTACT.ID)).toBeInTheDocument() | |
}, | |
}, | |
}, | |
success: { | |
meta: { | |
test: ({ getByTestId }) => { | |
const { current, week, progressive } = DATA.GET_USER_WALLET | |
expect(getByTestId(WALLET_TOTAL_CURRENCY.ID)).toHaveTextContent(current) | |
expect(getByTestId(WALLET_WEEK_CURRENCY.ID)).toHaveTextContent(week) | |
expect(getByTestId(WALLET_AMOUNT_CURRENCY.ID)).toHaveTextContent(progressive) | |
}, | |
}, | |
}, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment