Sorry, I know you asked us not to submit more errata on a recent podcast, but in the interest of correctness…
The test on p22 sets up the following data :
malformed_day = %{
# wrong key
"datetime" => 1_574_359_200,
"weather" => [
%{
"main" => 1
}
]
}
It claims that this helps us test the malformed datetime
key (which should be dt
). However, in the previous test, the test data was:
malformed_day = %{
"dt" => 1_574_359_200,
"weather" => [
%{
"wrong_key" => 1
}
]
Which is supposed to fail, because wrong_key
is incorrect.
However, in this new test, main
is also an incorrect key. So although datetime
is wrong, so is weather
, and as we are only asserting the function returns :response_format_invalid
, this test has no way to know that the datetime
error was the cause of the failure, because there is another failure cause (invalid weather
value) that we already tested for that is still happening).
To be correct, the test would have to include a valid value for weather
.