Skip to content

Commit f2be7a2

Browse files
committed
test: add test case for constructor with data and options parameters.
1 parent 7a7b7c2 commit f2be7a2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/dynamicBuffer.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ describe('Initialization tests', () => {
4646

4747
assert.equal(buffer.toString(), data);
4848
});
49+
50+
it('Test initializing with initial data and initial size', () => {
51+
const data = 'Hello world';
52+
const buffer = new DynamicBuffer(data, { size: 4 });
53+
54+
assert.equal(buffer.toString(), data);
55+
assert.equal(Reflect.get(buffer, 'size'), data.length); // size * (1 + factor) < data.length
56+
});
4957
});
5058

5159
describe('Resize tests', () => {

0 commit comments

Comments
 (0)