Skip to content

Commit

Permalink
Limited double wrapping, added skipped -0 test case
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB committed Jun 23, 2022
1 parent 65f4263 commit f931f12
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/node/double_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,24 @@ describe('Double', function () {

it('0', () => {
let value = 0;
let orig = new Double(value).valueOf();
let orig = new Double(value);
let newVal = twiceSerialized(orig);
expect(orig).to.equal(newVal);
expect(value).to.equal(newVal);
});

it('-0', () => {
let value = -0;
let orig = new Double(value).valueOf();
let orig = new Double(value);
let newVal = twiceSerialized(orig);
expect(orig).to.equal(newVal);
expect(Object.is(newVal, -0)).to.be.true;
});

// TODO (NODE-4335): -0 should be serialized as double
it.skip('-0 serializes as Double', () => {
let value = -0;
let serializedDouble = BSON.serialize({ d: value });
let type = serializedDouble[5];
expect(type).to.not.equal(BSON.BSON_DATA_NUMBER);
});

it('Number.EPSILON', () => {
Expand Down

0 comments on commit f931f12

Please sign in to comment.