0

Can someone please help me to write a jest test case for mapStateProps. I have read all the question everywhere but I was not able to releate to this.

Component code

function mapStateToProps({ leftRecords}) {
return { leftRecords};
}

Reducer:

export const leftRecords= (state = {}, action) => {
switch (action.type) {
case FETCH_LEFT_RECORDS:
return action.leftRecords;
default:
return state;
}
};

When I run the coverage it shows this function is not covered, I have no idea on how to write test case for mapStateProps, could someone please help me over this.

groot
  • 57
  • 3
  • 12
  • The test would depend on how the function is exported or used within the component – Teneff Feb 02 '21 at 08:53
  • @Teneff Should i give actions and reducers components here? I have added the reducer how to test it now? – groot Feb 02 '21 at 09:00

0 Answers0