react-state-patterns icon indicating copy to clipboard operation
react-state-patterns copied to clipboard

Asynchronous E2E Test

Open mcclayton opened this issue 6 years ago • 0 comments

Ensure library works for an Asynchronous E2E example by writing a test for it. i.e.:

const Counter = statePatterns(
  stateHook(
    (props) => ({ users: [], loading: false, error: null }),
    {
      fetchUsers: state => (sucessCb, errorCB) => { /* Make call and utilize callbacks */ },
      fetchUsersSuccess: () => users => ({ users, error: null, loading: false }),
      fetchUsersError: () => error => ({ users: [], error, loading: false })
    },
    "userStore"
  ),
);

mcclayton avatar Oct 15 '19 01:10 mcclayton