My question:
Submitting my collection currently returns error 'TypeError: Cannot read properties of undefined (reading ‘item)’
As far as I can tell, ‘item’ is undefined in the test script. I’m not 100% sure what ‘item’ is trying to do. I assume it is each name being returned by the GET request, but don’t know how to declare this in the test script.
I’m also assuming that we aren’t supposed to edit the test script used for submission of the challenges as you could force yourself to pass? If we are this is unclear.
When you submit your collection, it’s hitting the Postman collection endpoint, and should return a JSON response with all of the details in your collection.
The tests tab is then asserting on certain elements in the collection.
In your case, its not returning the correct JSON, as its failing the authentication. Therefore “item” which is a top level element in a normal response does not exist.
Make sure you have set the x-api-key header as per the instructions.
However, just going back through the instructions. It’s a bit odd that its tells you to use whatever method you want, which isn’t covered until day 4 which actually shows you the three main ways of authenticating.