@@ -25,23 +25,25 @@ describe('calculateSize()', () => {
2525 ) . to . throw ( BSONVersionError , / U n s u p p o r t e d B S O N v e r s i o n / 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