The aim of the exercise is to demonstrate your problem solving and understanding of JavaScript by implementing something found in every unit testing tool - an "assertEquals" method.
- Fill in the "assertEquals" function such that it will correctly compare "expected" vs "actual" parameters passed to it, including all the sample test data provided.
- You may add more functions.
- Credit will be given for approach, correctly identifying "failed" assertEquals, "clean" code, coding style and consideration of future requirements (i.e. how easy would your solution be to extend to more test cases).
- Please only use pure javascript, do not import any other libraries
The following tests should "fail": 02, 03, 04, 07, 08 and 09 - and the failures should be reported using the provided mechanism.
The failure messages should report further information:
- Test 02: Expected "abcdef" found "abc"
- Test 03: Expected type Array but found Object
- Test 04: Expected array length 2 but found 3
- Test 07: Expected propB.propA[1].propB "b" but found "c"
- Test 08: Expected propB.propC but was not found
- Test 09: Expected type null but found type Object