I have a reducer in react which I am testing I want to test the return value of a reduce inside the exports default function. And I'm not sure how to get access to the reduce inside that function.
MyReducer:
exports default function myReducer({
people = [0,1,2];
people.reduce(function(sum, peeps){
return sum + peeps;
}0);
return "hey";
})
In jest test:
import myReducer from 'myReducer';
expectedPeeps = 3;
expect(Something needs to go here).toEqual(expectedPeeps);
I need to figure out how to get the return value of people.reduce. I can get "hey" by just invoking myReducer(). But how do I get the return value of people.reduce in my test! ?thanks in advance peeps.
Aucun commentaire:
Enregistrer un commentaire