-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassertObjectsEqual.js
39 lines (23 loc) · 1.11 KB
/
assertObjectsEqual.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const eqObjects = require('./eqObjects');
const assertObjectsEqual = function(actual, expected) {
const inspect = require('util').inspect;
if (eqObjects(actual, expected)) {
console.log(`✅✅✅ Passed test: ${inspect(actual)} === ${inspect(expected)}`);
} else {
console.log(`🛑🛑🛑 Failed test: ${inspect(actual)} !== ${inspect(expected)}`);
}
};
// //Test Data
// const car = {brand: "Ford", model: "Escape", year: 2023, wheel: "All wheel drive"};
// const carolineCar = {brand: "Ford", model: "Escape", year: 2023, wheel: "All wheel drive"};
// const olagunju = {firstName: "Caroline", lastName: "Olagunju", age: 31, job: "Web developer"};
// const caroline = {firstName: "Caroline", lastName: "Olagunju", age: 31, job: "Web developer", school: "LHL"};
// const shirt = {colours: ["white", "green"], size: 2};
// const myShirt = {colours: ["white", "green"], size: 2};
// //pass
// assertObjectsEqual(car, carolineCar);
// //fail because the length is not equal
// assertObjectsEqual(olagunju, caroline);
// //pass
// assertObjectsEqual(shirt, myShirt);
module.exports = assertObjectsEqual;