This is how I think this works:
1) Check the number of keys in both objects are the same
2) Check that all keys in expected object are in actual object
3) Compare values for each key in each object
If they are objects, run the deepEqual() method recursively on them
If they are arrays, check that each value at each index is the same (order matters)
If they are different types, fail
Otherwise, if they are the same type, but not object or array, ensure === returns true
We can use chai's deepEqual() method to check if two objects are logically the same - that they contain the same data.
Link to Challenge : https://www.freecodecamp.org/learn/qu...
Written Guide: https://www.notion.so/ganeshh123/Asse...
Full Playlist for this course : • Quality Assurance and Testing with Chai - ...
All Writen Guides for this course : https://www.notion.so/ganeshh123/54ec...
All My Tutorials can be found at : https://www.notion.so/Tutorials-Ganes...
0:00 - Concepts:
0:22 - Example Objects
01:00 - How Objects are compared
01:52 - assert.deepEqual()
Asserts that actual is deeply equal to expected.
https://www.chaijs.com/api/assert/#me...
05:08 - assert.notDeepEqual()
Assert that actual is not deeply equal to expected.
https://www.chaijs.com/api/assert/#me...
05:32 - Order of Keys
06:08 - Challenge Solution
————————————————————————————————————
Chai is an assertion library, similar to Node's built-in assert. It makes testing much easier by giving you lots of assertions you can run against your code.
freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce students to HTML, CSS and JavaScript, students progress to project assignments that they complete either alone or in pairs. Upon completion of all project tasks, students are partnered with other nonprofits to build web applications, giving the students practical development experience.
Thanks for Watching!