Skip to content

Commit 6de6fdb

Browse files
committed
test(NODE-4887): Add test for toBSON
1 parent 931c59f commit 6de6fdb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/node/to_bson_test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ describe('toBSON', function () {
183183
const sizeNestedToBSON = BSON.calculateObjectSize({ a: [0] });
184184
expect(sizeNestedToBSON).to.equal(33);
185185
});
186+
187+
it('uses toBSON on elements of a Map', () => {
188+
const map = new Map();
189+
map.set('a', 100);
190+
191+
const serializedData = BSON.serialize(map);
192+
const deserializedData = BSON.deserialize(serializedData);
193+
expect(deserializedData).to.have.property('a', 'hello number');
194+
});
186195
});
187196

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

0 commit comments

Comments
 (0)