Skip to content

Commit 43e8725

Browse files
committed
test: fix titles
1 parent 7a2a9b7 commit 43e8725

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/node/parser/calculate_size.test.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,25 @@ describe('calculateSize()', () => {
2525
).to.throw(BSONVersionError, /Unsupported BSON version/i);
2626
});
2727

28-
describe('bigint', function () {
28+
describe('when given a bigint value with a single character key', function () {
2929
beforeEach(function () {
3030
if (BSON.__noBigInt__) {
3131
this.currentTest?.skip();
3232
}
3333
});
3434

35-
it('returns 8 bytes (+8 meta bytes) size for a bigint value', function () {
35+
it('returns 8 bytes (+4 bytes for document size + 1 type byte + 1 byte for "a" + 2 null terminators)', function () {
3636
const doc = { a: BigInt(1) };
37-
expect(BSON.calculateObjectSize(doc)).to.equal(16);
37+
expect(BSON.calculateObjectSize(doc)).to.equal(8 + 4 + 1 + 1 + 1 + 1);
3838
expect(BSON.calculateObjectSize(doc)).to.equal(BSON.serialize(doc).byteLength);
3939
});
4040
});
4141

42-
it('returns 0 bytes (+5 meta bytes) for a symbol value', function () {
43-
const doc = { a: Symbol() };
44-
expect(BSON.calculateObjectSize(doc)).to.equal(5);
45-
expect(BSON.calculateObjectSize(doc)).to.equal(BSON.serialize(doc).byteLength);
42+
describe('when given a symbol value with a single character key', function () {
43+
it('returns 0 bytes (+4 bytes for document size + 1 null terminator)', function () {
44+
const doc = { a: Symbol() };
45+
expect(BSON.calculateObjectSize(doc)).to.equal(4 + 1);
46+
expect(BSON.calculateObjectSize(doc)).to.equal(BSON.serialize(doc).byteLength);
47+
});
4648
});
4749
});

0 commit comments

Comments
 (0)