Equals vs. same in QUnit

When asserting whether or not two associative arrays (or objects) are identical, I first tried to use equals:

   equals({"foo":"bar"}, {"foo":"bar"}, "");

Turns out, this does not work (see the assertEquals definition). Instead, use same:

   same({"foo":"bar"}, {"foo":"bar"}, "");

Still, I like the error message you reveice when using equals:

failed, expected: { “foo”: “bar” } result: { “foo”: “bar” }

Advertisements