Out Of Order Assertion - Exercise: Nucleotide Count

my first iteration was my shortcut using ‘group_by’ and I realized that the test succeed if the keys are in order.

(from function `assert_equal' in file bats-extra.bash, line 178,
 in test file test-nucleotide-count.bats, line 30)
  `assert_equal "$output" "$expected"' failed
-- values do not equal --
expected : {"A":0,"C":0,"G":1,"T":0}
actual   : {"G":1,"A":0,"C":0,"T":0}
--

in order to submit the solution, I sort the keys to match the expected value.

In the next iteration, I put reduce with zero / init object whose keys order matches the expected. If I jumbled the keys order, the test failed.

(from function `assert_equal' in file bats-extra.bash, line 178,
 in test file test-nucleotide-count.bats, line 16)
  `assert_equal "$output" "$expected"' failed
-- values do not equal --
expected : {"A":0,"C":0,"G":0,"T":0}
actual   : {"C":0,"A":0,"T":0,"G":0}

IMO this is something wrong and I’m wondering how to fix this.

In other tracks we don’t care about the order of the keys and I think jq should update this exercise to either explain which order to return, to use lexicographical order, or to ignore the order altogether.

Yes, we’re using assert_equal in bats which is string equality. I’ll update this to compare objects with jq.

This has been resolved in When the expected result is an object, use jq to determine object equality by glennj · Pull Request #196 · exercism/jq · GitHub

glennj… glad you have fixed this. Thanks