I'm wondering if/how i can use Sinon to stub the object mappedValues
nested in the function below:
function getValueFromObj(key) {
var mappedValues = {
"a": "aaa",
"b": "bbb",
"c": "ccc",
"d": "ddd",
};
return mappedValues[key];
}
My goal for the test is not to check each value but rather just make sure that when passed a key
a correctly corresponding value is returned and the value is not augmented in any way.
I think the best way to test this is to have the test stub mappedValues
and then check the return value of getValueFromObj
but i'm not sure how to actually stub the object.