-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: BSON, EJSON, Spec Test Coverage
Use Case
As a node driver user
I want better assertions from the BSON corpus testing
So that I have confidence in EJSON serialization
Currently EJSON relaxed is checked by taking the JS object deserialized from the hex with promote settings disabled. I believe its the promote settings that are making the tests miss a case described in NODE-3390.
if (v.relaxed_extjson) { let rEJ = normalize(v.relaxed_extjson); // BSON -> native -> relaxed EJSON matches provided expect(nativeToREJSON(nativeFromCB)).to.equal(rEJ); // relaxed EJSON -> native -> relaxed EJSON unchanged expect(nativeToREJSON(jsonToNative(rEJ))).to.equal(rEJ); }
Edit Feb 10th 2022:
jsonToNative parses the extended JSON string with our extended JSON parser in canonical form. Instead we should directly test how the extended json serializer (EJSON.stringify) returns when relaxed: false when taking an input that was parsed with plain JSON.stringify.
Dependencies
- None
Unknowns
- How much effort it is to test relaxed JSON correctly, normalizing the stringified JSON can be tricky
Acceptance Criteria
- Check the Double Inf/NaN test is correctly asserting the results.
Implementation Requirements
- Unwrap nested serialization functions into separate assertions.
Testing Requirements
- n/a testing ticket
Documentation Requirements
- None
Follow Up Requirements
- None