ra-aws-amplify
ra-aws-amplify copied to clipboard
Jest tests for RaAmplifyPagination & reducer
Test coverage for;
nextTokenReducer
- an easy unit test, call it with {type: undefined}, expect null return
- call it with
{ type: CRUD_GET_LIST_SUCCESS, payload: {nextToken: undefined} }
- expect null return - call it with
{ type: CRUD_GET_LIST_SUCCESS, payload: {nextToken: "nextToken"} }
expect nextToken return
UnconnectedRaAmplifyPagination
-
<UnconnectedRaAmplifyPagination page={1} nextToken={null} />
- expect nothing returned -
<UnconnectedRaAmplifyPagination page={1} nextToken="nextToken" />
-expect(getByText(/next/i)).toBeInTheDocument()
-
<UnconnectedRaAmplifyPagination page={2} nextToken=null />
-expect(getByText(/previous/i)).toBeInTheDocument()