It would seem that the equal function consumed by assertEquals in the asserts module doesn't verify the deep equality of Map instances. Therefore:
assertEquals(
new Map([['foo', 'bar']]),
new Map([['bar', 'foo']]),
);
doesn't throw an AssertionError, whereas I'd certainly expect a test failure.
Was it an intentional decision to omit Map support, or is it an oversight? If it's the latter, I'm happy to raise a PR to fix it.
Looking at the labels, I'd say it's a bug. I'm thus happy to take a look at this @ry.
Closed in #3236 but it was a specific solution for Map, but I also assume this would have been valid for Set or in fact any iterable.
It might have been a better solution to detect iterables, iterate over their values, and compare those values deeply as well.
I didn't think of that @kitsonk, but I agree that would have been a lot more succinct. Probably one for next time!
Actually @kitsonk, I'll raise another PR to consolidate the Map and Set branches into a single Symbol.iterator in a...-esque conditional. I'll tackle it in a week or so.
Actually @kitsonk, I'll raise another PR to consolidate the
MapandSetbranches into a singleSymbol.iterator in a...-esque conditional. I'll tackle it in a week or so.
Addressed in #3258, although it's a bit more involved than it may appear on the surface.
Fixed in v0.23 馃嵕