//Testing Function
function testEqual(test, expect, got){
console.log(`Testing ${test}`);
if (expect === got){
console.log(`${test} has passed`);
return true;
} else {
console.log(`${test} has failed, expected ${expect} but got ${got}`);
return false;
}
}
//Run the tests
let passed = 0;
let tests = {
"temperatureCtoF":[75, temperatureCtoF(24)],
"temperatureInF Part 1":["88F", temperatureInF(88, 'F')],
"temperatureInF Part 2":["75F", temperatureInF(24, 'C')],
"makePersonObject": [{"id": 5, "name": 'Leia', "email": 'leia@leia.com'}, makePersonObject(5, "red", "leia@leia.com")],
}
console.log(tests["makePersonObject"]);
console.log(testEqual("makePersonObject", tests["makePersonObject"][0],tests["makePersonObject"][1]));
On the above code, I created a testEquals function and a bunch of tests, for the final test, I get the output "Testing makePersonObject index.js:212 makePersonObject has failed, expected [object Object] but got [object Object]" and I can't seem to figure out how to compare them correctly, I tried using === and .value in my test function but that didn't work.