Skip to content

Commit

Permalink
test(NODE-4887): Add test for toBSON
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Jan 6, 2023
1 parent 931c59f commit 6de6fdb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/node/to_bson_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ describe('toBSON', function () {
const sizeNestedToBSON = BSON.calculateObjectSize({ a: [0] });
expect(sizeNestedToBSON).to.equal(33);
});

it('uses toBSON on elements of a Map', () => {
const map = new Map();
map.set('a', 100);

const serializedData = BSON.serialize(map);
const deserializedData = BSON.deserialize(serializedData);
expect(deserializedData).to.have.property('a', 'hello number');
});
});

it('should use toBSON in calculateObjectSize', () => {
Expand Down

0 comments on commit 6de6fdb

Please # to comment.