Skip to content

Commit 810ca0c

Browse files
refactor(tests): replace assert.isOk(!...) with assert.isFalse
Replace generic assertions with more specific ones across test files: - Use assert.isFalse for boolean false checks - Use assert.strictEqual for numeric zero checks This improves test clarity and provides better error messages when assertions fail. Co-authored-by: Arthur Schreiber <arthurschreiber@users.noreply.github.com>
1 parent 1e983a4 commit 810ca0c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

test/unit/connector-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe('connectInSequence', function() {
248248

249249
assert.isOk(attemptedSockets[0].destroyed);
250250
assert.isOk(attemptedSockets[1].destroyed);
251-
assert.isOk(!attemptedSockets[2].destroyed);
251+
assert.isFalse(attemptedSockets[2].destroyed);
252252
});
253253

254254
it('will immediately abort when called with an aborted signal', async function() {
@@ -454,7 +454,7 @@ describe('connectInParallel', function() {
454454
controller.signal,
455455
);
456456

457-
assert.isOk(!attemptedSockets[0].destroyed);
457+
assert.isFalse(attemptedSockets[0].destroyed);
458458
assert.isOk(attemptedSockets[1].destroyed);
459459
assert.isOk(attemptedSockets[2].destroyed);
460460
});

test/unit/packet-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ describe('packet type tests', function() {
1313

1414
it('should be last', function() {
1515
let packet = new Packet(TYPE.PRELOGIN);
16-
assert.isOk(!packet.isLast());
16+
assert.isFalse(packet.isLast());
1717

1818
packet = new Packet(TYPE.PRELOGIN);
19-
assert.isOk(!packet.last());
19+
assert.isFalse(packet.last());
2020
packet.last(true);
2121
assert.isOk(packet.last());
2222
});
@@ -147,7 +147,7 @@ describe('packet type tests', function() {
147147

148148
it('should packet complete shorter than header', function() {
149149
const buffer = Buffer.alloc(7);
150-
assert.isOk(!isPacketComplete(buffer));
150+
assert.isFalse(isPacketComplete(buffer));
151151
});
152152

153153
it('should packet complete with just header', function() {
@@ -170,7 +170,7 @@ describe('packet type tests', function() {
170170
0x00
171171
]);
172172

173-
assert.isOk(!isPacketComplete(buffer));
173+
assert.isFalse(isPacketComplete(buffer));
174174
});
175175

176176
it('should packet complete long enough', function() {

test/unit/token/done-token-parser-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ describe('Done Token Parser', () => {
3535
const token = result.value;
3636

3737
assert.instanceOf(token, DoneToken);
38-
assert.isOk(!token.more);
38+
assert.isFalse(token.more);
3939
assert.strictEqual(token.curCmd, curCmd);
40-
assert.isOk(!token.rowCount);
40+
assert.strictEqual(token.rowCount, 0);
4141
});
4242

4343
it('should more', async () => {
@@ -67,7 +67,7 @@ describe('Done Token Parser', () => {
6767
const token = result.value;
6868

6969
assert.instanceOf(token, DoneToken);
70-
assert.isOk(!token.more);
70+
assert.isFalse(token.more);
7171
assert.strictEqual(token.curCmd, 1);
7272
assert.strictEqual(token.rowCount, doneRowCount);
7373
});

0 commit comments

Comments
 (0)