Closed pixelzoom closed 7 years ago
I removed the JSON.stringify
comparison and did a property-by-property comparison of actual and expected results, including a deep comparison of arrays. This is going to be problematic for arrays of non-integral types, and for type 'custom'.
And there are other problems here. Verifying that something fails when it's supposed to is cumbersome, and doesn't fit with the "passing" tests. And while this started out as 1 test schema, that seems to be falling apart - people have obviously been tacking tests on that have their own schemas.
Imo, this is complicated enough that we should consider using qunit.
@samreid How do you want to proceed with this test harness?
test-query-string-machine now uses QUnit, including assert.throws
and assert.deepEquals
, it is much nicer now.
@pixelzoom would you like to take a look?
👍 Closing.
testQueryStringMachine.js has a serious problem. It's fundamentally based on comparing the results of
JSON.stringify
, which is not guaranteed to return results in any predictable order.Here's the problematic code:
Even if
JSON.stringify
did guarantee order, there's another problem with this approach. It requiresexpected
andschema
to have all of their fields listed in the same order.