Improve unit tests

For reasons I don't understand, some unit tests started failing because the order of items in arrays are not deterministic. In hindsight this is not surprising, I just don't understand why the tests were stable for so long until now.

Also took the opportunity to use more specific & actionable assertions (assert.strictEqual, etc.).