Assignment 2 autograding error: “to contain <jasmine.objectContaining(Object({ scoringFunction: Function }))>

Hi guys,
Finally finished my assignment 2 code & got it working.

When I submitted to the autograder just now, I got only 1 autograding failure, screen shot below.

Can anyone tell what this autograding failure is asking me to change? I know that usually you have to amend your code to align with what comes after “to contain” but I don’t understand what “to contain <jasmine.objectContaining(Object({ scoringFunction: Function }))>.” means?

Hi @emgraham,

Looking at what the failing test wants you to include via looking after the “to contain” statement is great. It helps me to also check the difference between what the tests expect my output to contain and what my output actually contains.

Take a look at the actual output Jasmine received after both “Message” on line 31 and “Error” on line 33. We can see the three objects of our scoringAlgorithm array and their properties, like “name: ‘Simple Score’”, etc. Since we’re working with the scoringAlgorithms array and its objects, the key piece of info from “to contain <jasmine.objectContaining(Object({ scoringFunction: Function }))>” is the property it outlines, ‘scoringFunction’ which is meant to contain one of the three different scoring functions, but the actual specifics of each function don’t really matter for this error.

Look for the difference between the function properties after “expected” and the one after “to contain”. It’s a small difference that’s easy to miss, and is kind of buried in the error feedback. You can get a somewhat clearer view of what precisely is expected in the .spec file itself.

1 Like

You would not believe the amount of time I sat looking at that without realizing that I had coded “scorerFunction” instead of what they required - “scoringFunction”.
Thanks @jwrounds!

@emgraham me too! I’ve found sometimes tests can be very specific.