Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/integration/bulk-load-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ describe('BulkLoad', function() {
connection.execSqlBatch(request);
});

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

Expand All @@ -1522,7 +1522,7 @@ describe('BulkLoad', function() {
}
});

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

Expand Down Expand Up @@ -1554,7 +1554,7 @@ describe('BulkLoad', function() {
});
});

it('should not throw in _transform function', (done) => {
it('should not throw in _transform function', function(done) {
const bulkLoad = connection.newBulkLoad(
'#tmpTestTable',
(err, rowCount) => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/connection-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ update #tab1 set name = 'a3' where name like 'a%'\
}
});

it('should request timeout', (done) => {
it('should request timeout', function(done) {
const request = new Request(
"select 1 as C1;waitfor delay '00:00:05';select 2 as C2",
function(err, rowCount, rows) {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/all-headers-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { assert } from 'chai';
import WritableTrackingBuffer from '../../src/tracking-buffer/writable-tracking-buffer';
import { writeToTrackingBuffer as writeAllHeaders } from '../../src/all-headers';

describe('all headers test', function() {
describe('All Headers', function() {
it('should write headers', function() {
const expected = Buffer.from([
0x16,
Expand Down
8 changes: 4 additions & 4 deletions test/unit/connector-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('connectInSequence', function() {
assert.strictEqual(attemptedConnections[2].localAddress, '192.168.0.1');
});

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

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

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

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

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

let expectedSocket: any;
Expand Down Expand Up @@ -439,7 +439,7 @@ describe('connectInParallel', function() {
assert.strictEqual(expectedSocket, socket);
});

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

Expand Down
10 changes: 5 additions & 5 deletions test/unit/debug-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class MockPacket {
}
}

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

const debug = new Debug({ packet: true });
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('Packet Tests', function() {
});
});

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

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

it('should not enable payload', function(done) {
it('should not emit token debug events when disabled', function(done) {
const debug = new Debug();
debug.on('debug', function() {
assert.fail('Expected no debug event to be emitted');
Expand Down
2 changes: 1 addition & 1 deletion test/unit/incoming-message-stream-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('IncomingMessageStream', function() {
});
});

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

Expand Down
8 changes: 4 additions & 4 deletions test/unit/instance-lookup-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,30 +314,30 @@ describe('InstanceLookup', function() {
});

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

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

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

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

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

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

it('twoInstancesNotFound', function() {
it('should return undefined when no instance matches', function() {
const response =
'ServerName;WINDOWS2;InstanceName;XXXXXXXXXX;IsClustered;No;Version;10.50.2500.0;tcp;0;;' +
'ServerName;WINDOWS2;InstanceName;YYYYYYYYYY;IsClustered;No;Version;10.50.2500.0;tcp;0;;';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ntlm-payload-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const challenge = {
}
};

describe('ntlm payload test', function() {
describe('NTLMPayload', function() {
it('should respond to challenge', function() {

const response = new NTLMPayload(challenge);
Expand Down
12 changes: 6 additions & 6 deletions test/unit/packet-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('packet type tests', function() {
assert.strictEqual(packet.dataToString('--'), expectedText);
});

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

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

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

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

assert.isTrue(isPacketComplete(buffer));
});

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

it('should packet complete long enough', function() {
it('should report complete when buffer matches declared length', function() {
const buffer = Buffer.from([
0x00,
0x00,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/prelogin-payload-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function assertPayload(payload: PreloginPayload, encryptionString: string, { maj
assert.strictEqual(payload.fedAuthRequired, 1);
}

describe('prelogin-payload-assert', function() {
describe('PreloginPayload', function() {
it('should not encrypt', function() {
const payload = new PreloginPayload();
assertPayload(payload, 'NOT_SUP', { major: 0, minor: 0, build: 0, subbuild: 0 });
Expand Down
2 changes: 1 addition & 1 deletion test/unit/rerouting-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ describe('Connecting to a server that sends a re-routing information', function(
}
});

it('it should throw an error with redirect information when targetserver connection failed', async function() {
it('should throw an error with redirect information when target server connection fails', async function() {
routingServer.on('connection', async (connection) => {
const debug = new Debug();
const incomingMessageStream = new IncomingMessageStream(debug);
Expand Down
20 changes: 10 additions & 10 deletions test/unit/tedious-test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Connection, ISOLATION_LEVEL, TYPES } from '../../src/tedious';
import { assert } from 'chai';

describe('tedious-test', function() {
describe('Tedious', function() {

it('types', function() {
assert.isDefined(TYPES);
assert.isDefined(TYPES.VarChar);
it('should export TYPES', function() {
assert.ok(TYPES);
assert.ok(TYPES.VarChar);
});

it('isolationLevel', function() {
assert.isDefined(ISOLATION_LEVEL);
assert.isDefined(ISOLATION_LEVEL.READ_UNCOMMITTED);
it('should export ISOLATION_LEVEL', function() {
assert.ok(ISOLATION_LEVEL);
assert.ok(ISOLATION_LEVEL.READ_UNCOMMITTED);
});

it('connection', function() {
assert.isDefined(Connection);
it('should export Connection', function() {
assert.ok(Connection);
});

it('connectionDoesNotModifyPassedConfig', function() {
it('should not modify the passed config object', function() {
const config = {
server: 'localhost',
userName: 'sa',
Expand Down
4 changes: 2 additions & 2 deletions test/unit/token/colmetadata-token-parser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Colmetadata Token Parser', function() {
});
});

it('should int', async function() {
it('should parse Int column metadata', async function() {
const debug = new Debug();
const numberOfColumns = 1;
const userType = 2;
Expand Down Expand Up @@ -81,7 +81,7 @@ describe('Colmetadata Token Parser', function() {
assert.isTrue((await parser.next()).done);
});

it('should varchar', async function() {
it('should parse VarChar column metadata', async function() {
const debug = new Debug();
const numberOfColumns = 1;
const userType = 2;
Expand Down
8 changes: 4 additions & 4 deletions test/unit/token/done-token-parser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function parse(status: number, curCmd: number, doneRowCount: number) {
return parser;
}

describe('Done Token Parser', function() {
it('should done', async function() {
describe('Done Token Parser', () => {
it('should parse a final done token', async function() {
const status = 0x0000;
const curCmd = 1;
const doneRowCount = 2;
Expand All @@ -40,7 +40,7 @@ describe('Done Token Parser', function() {
assert.isUndefined(token.rowCount);
});

it('should more', async function() {
it('should parse a done token with more results', async function() {
const status = 0x0001;
const curCmd = 1;
const doneRowCount = 2;
Expand All @@ -56,7 +56,7 @@ describe('Done Token Parser', function() {
assert.isUndefined(token.rowCount);
});

it('should done row count', async function() {
it('should parse a done token with row count', async function() {
const status = 0x0010;
const curCmd = 1;
const doneRowCount = 0x1200000034;
Expand Down
8 changes: 4 additions & 4 deletions test/unit/token/env-change-token-parser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { assert } from 'chai';

const options = { tdsVersion: '7_2', useUTC: false } as ParserOptions;

describe('Env Change Token Parser', function() {
it('should write to database', async function() {
describe('Env Change Token Parser', () => {
it('should parse database change', async function() {
const debug = new Debug();
const oldDb = 'old';
const newDb = 'new';
Expand All @@ -34,7 +34,7 @@ describe('Env Change Token Parser', function() {
assert.strictEqual(token.newValue, 'new');
});

it('should write with correct packet size', async function() {
it('should parse packet size change', async function() {
const debug = new Debug();
const oldSize = '1024';
const newSize = '2048';
Expand All @@ -61,7 +61,7 @@ describe('Env Change Token Parser', function() {
assert.strictEqual(token.newValue, 2048);
});

it('should be of bad type', async function() {
it('should skip unknown env change types', async function() {
const debug = new Debug();
const buffer = new WritableTrackingBuffer(50, 'ucs2');

Expand Down
4 changes: 2 additions & 2 deletions test/unit/token/feature-ext-parser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { assert } from 'chai';

const options = { tdsVersion: '7_2', useUTC: false } as ParserOptions;

describe('Feature Ext Parser', function() {
it('should be fed authentication', async function() {
describe('Feature Ext Parser', () => {
it('should parse federated authentication token', async function() {
const debug = new Debug();
const buffer = new WritableTrackingBuffer(50, 'ucs2');

Expand Down
Loading