Prove its working correctly, that's why we write tests. and to have a good test, we should be careful in choosing what we are testing for, also, the data we are going to test.
An important note, testing for a result that is coming back from an API request, should include:
Testing for the status code.
The response body length.
Coming data types.
Some of the expected data that comes with the response.
Also, you are using deepEqual to compare a string with another, it will work correctly, but, the CORRECT way to compare anything that is not an object, is by using equal(), but, to test the equality of two objects, we can safely do that with deepEqual()
Hi,
Prove its working correctly, that's why we write tests. and to have a good test, we should be careful in choosing what we are testing for, also, the data we are going to test.
An important note, testing for a result that is coming back from an API request, should include:
In this snippet of code, also the other tests: https://github.com/FACG5/Later-team/blob/aaf09e86bb9ef670f8be49789e2e8d704cffb617/tests/test.js#L9
Consider the above note.
Also, you are using
deepEqual
to compare a string with another, it will work correctly, but, the CORRECT way to compare anything that is not an object, is by usingequal()
, but, to test the equality of two objects, we can safely do that withdeepEqual()