Skip to content

Commit fc288ed

Browse files
test: improve clarity of test names (#1720)
* test: improve test names for clarity and fix typos - Fix typos: 'succesfully' -> 'successfully' in connector-test.ts - Fix typo: 'Wrtiable' -> 'Writable' in writable-tracking-buffer-test.ts - Fix typo: 'package' -> 'packet' in incoming-message-stream-test.ts - Fix typo: 'mulitple' -> 'multiple' in packet-test.ts - Rename 'Packet Tests' describe block to 'Debug' in debug-test.ts - Change 'should write X' to 'should parse X' in row-token-parser-test.ts - Fix awkward test names in done-token-parser-test.ts - Fix test names in env-change-token-parser-test.ts - Rename describe blocks for consistency (PreloginPayload, NTLMPayload, etc.) - Fix camelCase test names to readable sentences in instance-lookup-test.ts - Fix unclear test names in packet-test.ts - Fix redundant 'it' prefix in rerouting-test.ts - Fix awkward phrasing in feature-ext-parser-test.ts - Improve test names in tedious-test.ts, colmetadata-token-parser-test.ts - Rename TransientErrorLookup describe block and test names * test: rename debug test names for consistency Update 'should not enable payload' and 'should not enable data' to 'should not emit payload debug events when disabled' and 'should not emit data debug events when disabled' for consistency with the token test naming pattern. * Undo unintended changes. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent b2cd699 commit fc288ed

20 files changed

+84
-84
lines changed

test/integration/bulk-load-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ describe('BulkLoad', function() {
15041504
connection.execSqlBatch(request);
15051505
});
15061506

1507-
it('should handle validation errors during streaming bulk loads', (done) => {
1507+
it('should handle validation errors during streaming bulk loads', function(done) {
15081508
const bulkLoad = connection.newBulkLoad('#stream_test', completeBulkLoad);
15091509
bulkLoad.addColumn('value', TYPES.Date, { nullable: false });
15101510

@@ -1522,7 +1522,7 @@ describe('BulkLoad', function() {
15221522
}
15231523
});
15241524

1525-
it('should allow reusing the connection after validation errors during streaming bulk loads', (done) => {
1525+
it('should allow reusing the connection after validation errors during streaming bulk loads', function(done) {
15261526
const bulkLoad = connection.newBulkLoad('#stream_test', completeBulkLoad);
15271527
bulkLoad.addColumn('value', TYPES.Date, { nullable: false });
15281528

@@ -1554,7 +1554,7 @@ describe('BulkLoad', function() {
15541554
});
15551555
});
15561556

1557-
it('should not throw in _transform function', (done) => {
1557+
it('should not throw in _transform function', function(done) {
15581558
const bulkLoad = connection.newBulkLoad(
15591559
'#tmpTestTable',
15601560
(err, rowCount) => {

test/integration/connection-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ update #tab1 set name = 'a3' where name like 'a%'\
14281428
}
14291429
});
14301430

1431-
it('should request timeout', (done) => {
1431+
it('should request timeout', function(done) {
14321432
const request = new Request(
14331433
"select 1 as C1;waitfor delay '00:00:05';select 2 as C2",
14341434
function(err, rowCount, rows) {

test/unit/all-headers-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { assert } from 'chai';
22
import WritableTrackingBuffer from '../../src/tracking-buffer/writable-tracking-buffer';
33
import { writeToTrackingBuffer as writeAllHeaders } from '../../src/all-headers';
44

5-
describe('all headers test', function() {
5+
describe('All Headers', function() {
66
it('should write headers', function() {
77
const expected = Buffer.from([
88
0x16,

test/unit/connector-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe('connectInSequence', function() {
125125
assert.strictEqual(attemptedConnections[2].localAddress, '192.168.0.1');
126126
});
127127

128-
it('passes the first succesfully connected socket to the callback', async function() {
128+
it('passes the first successfully connected socket to the callback', async function() {
129129
const controller = new AbortController();
130130

131131
let expectedSocket: any;
@@ -222,7 +222,7 @@ describe('connectInSequence', function() {
222222
assert.strictEqual(error.errors[2].message, 'failed connection #3');
223223
});
224224

225-
it('destroys all sockets except for the first succesfully connected socket', async function() {
225+
it('destroys all sockets except for the first successfully connected socket', async function() {
226226
const controller = new AbortController();
227227
const attemptedSockets: any[] = [];
228228

@@ -411,7 +411,7 @@ describe('connectInParallel', function() {
411411
assert.strictEqual(error.errors[2].message, 'failed connection #3');
412412
});
413413

414-
it('passes the first succesfully connected socket to the callback', async function() {
414+
it('passes the first successfully connected socket to the callback', async function() {
415415
const controller = new AbortController();
416416

417417
let expectedSocket: any;
@@ -439,7 +439,7 @@ describe('connectInParallel', function() {
439439
assert.strictEqual(expectedSocket, socket);
440440
});
441441

442-
it('destroys all sockets except for the first succesfully connected socket', async function() {
442+
it('destroys all sockets except for the first successfully connected socket', async function() {
443443
const controller = new AbortController();
444444
const attemptedSockets: any[] = [];
445445

test/unit/debug-test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class MockPacket {
1616
}
1717
}
1818

19-
describe('Packet Tests', function() {
20-
it('Create new packet', function(done) {
19+
describe('Debug', function() {
20+
it('should emit debug events when sending a packet', function(done) {
2121
let emitCount = 0;
2222

2323
const debug = new Debug({ packet: true });
@@ -52,7 +52,7 @@ describe('Packet Tests', function() {
5252
});
5353
});
5454

55-
it('should not enable payload', function(done) {
55+
it('should not emit payload debug events when disabled', function(done) {
5656
const debug = new Debug();
5757
debug.on('debug', function() {
5858
assert.fail('Expected no debug event to be emitted');
@@ -74,7 +74,7 @@ describe('Packet Tests', function() {
7474
debug.data(new MockPacket() as Packet);
7575
});
7676

77-
it('should not enable data', function(done) {
77+
it('should not emit data debug events when disabled', function(done) {
7878
const debug = new Debug();
7979
debug.on('debug', function() {
8080
assert.fail('Expected no debug event to be emitted');
@@ -96,7 +96,7 @@ describe('Packet Tests', function() {
9696
debug.token({ name: 'test' } as Token);
9797
});
9898

99-
it('should not enable payload', function(done) {
99+
it('should not emit token debug events when disabled', function(done) {
100100
const debug = new Debug();
101101
debug.on('debug', function() {
102102
assert.fail('Expected no debug event to be emitted');

test/unit/incoming-message-stream-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe('IncomingMessageStream', function() {
107107
});
108108
});
109109

110-
it('correctly handles the last package coming in after the stream was paused', function(done) {
110+
it('correctly handles the last packet coming in after the stream was paused', function(done) {
111111
const packetData = Buffer.from('test1234');
112112
const packetHeader = Buffer.alloc(8);
113113

test/unit/instance-lookup-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,30 +314,30 @@ describe('InstanceLookup', function() {
314314
});
315315

316316
describe('parseBrowserResponse', function() {
317-
it('oneInstanceFound', function() {
317+
it('should find port when one instance matches', function() {
318318
const response =
319319
'ServerName;WINDOWS2;InstanceName;SQLEXPRESS;IsClustered;No;Version;10.50.2500.0;tcp;1433;;';
320320

321321
assert.strictEqual(parseBrowserResponse(response, 'sqlexpress'), 1433);
322322
});
323323

324-
it('twoInstancesFoundInFirst', function() {
324+
it('should find port in first instance when two instances exist', function() {
325325
const response =
326326
'ServerName;WINDOWS2;InstanceName;SQLEXPRESS;IsClustered;No;Version;10.50.2500.0;tcp;1433;;' +
327327
'ServerName;WINDOWS2;InstanceName;XXXXXXXXXX;IsClustered;No;Version;10.50.2500.0;tcp;0;;';
328328

329329
assert.strictEqual(parseBrowserResponse(response, 'sqlexpress'), 1433);
330330
});
331331

332-
it('twoInstancesFoundInSecond', function() {
332+
it('should find port in second instance when two instances exist', function() {
333333
const response =
334334
'ServerName;WINDOWS2;InstanceName;XXXXXXXXXX;IsClustered;No;Version;10.50.2500.0;tcp;0;;' +
335335
'ServerName;WINDOWS2;InstanceName;SQLEXPRESS;IsClustered;No;Version;10.50.2500.0;tcp;1433;;';
336336

337337
assert.strictEqual(parseBrowserResponse(response, 'sqlexpress'), 1433);
338338
});
339339

340-
it('twoInstancesNotFound', function() {
340+
it('should return undefined when no instance matches', function() {
341341
const response =
342342
'ServerName;WINDOWS2;InstanceName;XXXXXXXXXX;IsClustered;No;Version;10.50.2500.0;tcp;0;;' +
343343
'ServerName;WINDOWS2;InstanceName;YYYYYYYYYY;IsClustered;No;Version;10.50.2500.0;tcp;0;;';

test/unit/ntlm-payload-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const challenge = {
1111
}
1212
};
1313

14-
describe('ntlm payload test', function() {
14+
describe('NTLMPayload', function() {
1515
it('should respond to challenge', function() {
1616

1717
const response = new NTLMPayload(challenge);

test/unit/packet-test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('packet type tests', function() {
9898
assert.strictEqual(packet.dataToString('--'), expectedText);
9999
});
100100

101-
it('should data with exact lines worth', function() {
101+
it('should convert data to string with exactly one line of data', function() {
102102
const dataLine1a = Buffer.from([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]);
103103
const dataLine1b = Buffer.from([0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]);
104104
const dataLine2a = Buffer.from([0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17]);
@@ -118,7 +118,7 @@ describe('packet type tests', function() {
118118
assert.strictEqual(packet.dataToString('--'), expectedText);
119119
});
120120

121-
it('should convert data to strings in mulitple lines', function() {
121+
it('should convert data to strings in multiple lines', function() {
122122
const dataLine1a = Buffer.from([0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]);
123123
const dataLine1b = Buffer.from([0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]);
124124
const dataLine2a = Buffer.from([0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17]);
@@ -146,18 +146,18 @@ describe('packet type tests', function() {
146146
assert.strictEqual(packet.dataToString('--'), expectedText);
147147
});
148148

149-
it('should packet complete shorter than header', function() {
149+
it('should report incomplete when buffer is shorter than header', function() {
150150
const buffer = Buffer.alloc(7);
151151
assert.isFalse(isPacketComplete(buffer));
152152
});
153153

154-
it('should packet complete with just header', function() {
154+
it('should report complete when buffer contains only header', function() {
155155
const buffer = new Packet(TYPE.PRELOGIN).buffer;
156156

157157
assert.isTrue(isPacketComplete(buffer));
158158
});
159159

160-
it('should not packet complete too short', function() {
160+
it('should report incomplete when buffer is shorter than declared length', function() {
161161
const buffer = Buffer.from([
162162
0x00,
163163
0x00,
@@ -174,7 +174,7 @@ describe('packet type tests', function() {
174174
assert.isFalse(isPacketComplete(buffer));
175175
});
176176

177-
it('should packet complete long enough', function() {
177+
it('should report complete when buffer matches declared length', function() {
178178
const buffer = Buffer.from([
179179
0x00,
180180
0x00,

test/unit/prelogin-payload-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function assertPayload(payload: PreloginPayload, encryptionString: string, { maj
2121
assert.strictEqual(payload.fedAuthRequired, 1);
2222
}
2323

24-
describe('prelogin-payload-assert', function() {
24+
describe('PreloginPayload', function() {
2525
it('should not encrypt', function() {
2626
const payload = new PreloginPayload();
2727
assertPayload(payload, 'NOT_SUP', { major: 0, minor: 0, build: 0, subbuild: 0 });

0 commit comments

Comments
 (0)