Skip to content

Commit 07ace37

Browse files
committed
clean up comment + test suites
1 parent 9acd6b6 commit 07ace37

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/bson.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export interface Document {
112112
const MAXSIZE = 1024 * 1024 * 17;
113113

114114
// Current Internal Temporary Serialization Buffer
115-
let buffer = Buffer.allocUnsafe(MAXSIZE);
115+
let buffer = Buffer.alloc(MAXSIZE);
116116

117117
/**
118118
* Sets the size of the internal serialization buffer.

test/node/decimal128_tests.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22

3-
// const { BSONTypeError } = require('../register-bson');
43
const BSON = require('../register-bson');
54
const Decimal128 = BSON.Decimal128;
65

@@ -1219,14 +1218,17 @@ describe('Decimal128', function () {
12191218
expect(new Decimal128('-1e400').toString()).to.equal('-1E+400');
12201219
});
12211220

1222-
it('throws appropriate error for invalid constructor arguments', () => {
1223-
const byteLengthErrMsg = 'Decimal128 must take a Buffer of 16 bytes';
1221+
it('throws correct error for invalid constructor argument type', () => {
12241222
const constructorArgErrMsg = 'Decimal128 must take a Buffer or string';
12251223

12261224
expect(() => new Decimal128(-0)).to.throw(constructorArgErrMsg);
12271225
expect(() => new Decimal128(-1)).to.throw(constructorArgErrMsg);
12281226
expect(() => new Decimal128(10)).to.throw(constructorArgErrMsg);
12291227
expect(() => new Decimal128(1111111111111111)).to.throw(constructorArgErrMsg);
1228+
});
1229+
1230+
it('throws correct error for an invalid Buffer constructor argument', () => {
1231+
const byteLengthErrMsg = 'Decimal128 must take a Buffer of 16 bytes';
12301232

12311233
expect(() => new Decimal128(new Uint8Array(0))).to.throw(byteLengthErrMsg);
12321234
expect(() => new Decimal128(Buffer.alloc(0))).to.throw(byteLengthErrMsg);

0 commit comments

Comments
 (0)