Skip to content

Commit 9e0a86b

Browse files
committed
test: add string eq checks for common cases
1 parent 0a3deec commit 9e0a86b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/node/binary.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,28 @@ describe('class Binary', () => {
8181
});
8282

8383
context('inspect()', () => {
84+
it('when value is default returns "new Binary()"', () => {
85+
expect(new Binary().inspect()).to.equal('new Binary()');
86+
});
87+
88+
it('when value is empty returns "new Binary()"', () => {
89+
expect(new Binary(new Uint8Array(0)).inspect()).to.equal('new Binary()');
90+
});
91+
92+
it('when value is default with a subtype returns "new Binary()"', () => {
93+
expect(new Binary(null, 0x23).inspect()).to.equal('new Binary(undefined, 35)');
94+
});
95+
96+
it('when value is empty with a subtype returns "new Binary(undefined, 35)"', () => {
97+
expect(new Binary(new Uint8Array(0), 0x23).inspect()).to.equal('new Binary(undefined, 35)');
98+
});
99+
100+
it('when value is empty returns "Binary.createFromBase64("", 0)"', () => {
101+
expect(new Binary(Buffer.from('abcdef', 'utf8')).inspect()).to.equal(
102+
'Binary.createFromBase64("YWJjZGVm", 0)'
103+
);
104+
});
105+
84106
context('when result is executed', () => {
85107
it('is deep equal with a Binary that has no data', () => {
86108
const bsonValue = new Binary();

0 commit comments

Comments
 (0)