Hello I'm trying to test the createSelector
function in jest
but I'm stuck. So the problem is that never enters in the if
of the function getContent
and I need to enter, for the coverage.
File
export const selectDetailsObject = createSelector(
[
(state) => state.objectId,
(state) => state.objects,
],
(
objectId,
objects,
) => getContent(objectId, objects)
)
function getContent (objectId, objects) {
const result = {}
if (objectId && objectId !== '') {
result.objectId = objectId
result.objectInfo = objects[objectId]
result.objectDetails = objectDetails[objectId]
}
return result
}
Testing file
const mockStore = () => ({
objectId: '123',
objects: {},
})
test('should select the content of the table', () => {
const result = selectDetailsObject(mockStore)
expect(result.objects).toBe()
})
Any suggestions?