Skip to content

Commit b89192e

Browse files
committed
update to chai
1 parent 77a33a3 commit b89192e

18 files changed

+132
-37
lines changed

Diff for: .eslintrc.cjs

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ module.exports = {
2828
"@typescript-eslint/consistent-type-imports":"off",
2929
"@typescript-eslint/ban-types":"off",
3030
"@typescript-eslint/prefer-ts-expect-error":"off",
31-
"@typescript-eslint/explicit-function-return-type":"off"
31+
"@typescript-eslint/explicit-function-return-type":"off",
32+
"@typescript-eslint/no-unsafe-argument":"off",
33+
"@typescript-eslint/unbound-method":" off"
3234
},
3335
};

Diff for: lib/connection.js

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class PrivateConnection {
5454

5555
open () {
5656
this.nf.validateParameters(this.validationParams(), this.parentFn)
57+
//
5758
this.callback2 = this.callback2 || this.defaultCallback
5859
this.native.open(this.connectObj, (e, c) => { this.queueCb(e, c) })
5960
}

Diff for: test/geography.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ describe('geography', function () {
3434
this.beforeEach(done => {
3535
env.open().then(() => {
3636
done()
37+
}).catch(e => {
38+
console.error(e)
3739
})
3840
})
3941

4042
this.afterEach(done => {
41-
env.close().then(() => { done() })
43+
env.close().then(() => { done() }).catch(e => {
44+
console.error(e)
45+
})
4246
})
4347

4448
function getTVPTable (vec, table) {

Diff for: test/json.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ describe('json', function () {
1010
this.timeout(30000)
1111

1212
this.beforeEach(done => {
13-
env.open().then(() => done())
13+
env.open().then(() => {
14+
done()
15+
}).catch(e => {
16+
console.error(e)
17+
})
1418
})
1519

1620
this.afterEach(done => {
17-
env.close().then(() => done())
21+
env.close().then(() => { done() }).catch(e => {
22+
console.error(e)
23+
})
1824
})
1925

2026
function insertRec (p, id, element) {

Diff for: test/multiple-errors.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ describe('multiple-error', function () {
3232
this.timeout(30000)
3333

3434
this.beforeEach(done => {
35-
env.open().then(() => { done() })
35+
env.open().then(() => {
36+
done()
37+
}).catch(e => {
38+
console.error(e)
39+
})
3640
})
3741

3842
this.afterEach(done => {
39-
env.close().then(() => { done() })
43+
env.close().then(() => { done() }).catch(e => {
44+
console.error(e)
45+
})
4046
})
4147

4248
it('non trusted invalid user', done => {

Diff for: test/params.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,18 @@ const assert = chai.assert
3535
describe('params', function () {
3636
this.timeout(60000)
3737

38-
this.beforeEach(async function handler () {
39-
await env.open()
38+
this.beforeEach(done => {
39+
env.open().then(() => {
40+
done()
41+
}).catch(e => {
42+
console.error(e)
43+
})
4044
})
4145

42-
this.afterEach(async function handler () {
43-
await env.close()
46+
this.afterEach(done => {
47+
env.close().then(() => { done() }).catch(e => {
48+
console.error(e)
49+
})
4450
})
4551

4652
class MetaTypes {

Diff for: test/parsing.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,18 @@ const env = new TestEnv()
3232
describe('parsing', function () {
3333
this.timeout(60000)
3434

35-
this.beforeEach(async function handler () {
36-
await env.open()
35+
this.beforeEach(done => {
36+
env.open().then(() => {
37+
done()
38+
}).catch(e => {
39+
console.error(e)
40+
})
3741
})
3842

39-
this.afterEach(async function handler () {
40-
await env.close()
43+
this.afterEach(done => {
44+
env.close().then(() => { done() }).catch(e => {
45+
console.error(e)
46+
})
4147
})
4248

4349
it('check decomposition of table name MyTable', function handler () {

Diff for: test/pause.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ describe('pause', function () {
1111
this.timeout(30000)
1212

1313
this.beforeEach(done => {
14-
env.open().then(() => done())
14+
env.open().then(() => {
15+
done()
16+
}).catch(e => {
17+
console.error(e)
18+
})
1519
})
1620

1721
this.afterEach(done => {
18-
env.close().then(() => done())
22+
env.close().then(() => { done() }).catch(e => {
23+
console.error(e)
24+
})
1925
})
2026

2127
it('resume query having never paused', testDone => {

Diff for: test/promises.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ describe('promises', function () {
1717
this.timeout(30000)
1818

1919
this.beforeEach(done => {
20-
env.open().then(() => { done() })
20+
env.open().then(() => {
21+
done()
22+
}).catch(e => {
23+
console.error(e)
24+
})
2125
})
2226

2327
this.afterEach(done => {
24-
env.close().then(() => { done() })
28+
env.close().then(() => { done() }).catch(e => {
29+
console.error(e)
30+
})
2531
})
2632

2733
it('calculate row receive rate from aggregator', async function handler () {

Diff for: test/query.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,17 @@ describe('query', function () {
3131
this.timeout(30000)
3232

3333
this.beforeEach(done => {
34-
env.open().then(() => { done() })
34+
env.open().then(() => {
35+
done()
36+
}).catch(e => {
37+
console.error(e)
38+
})
3539
})
3640

3741
this.afterEach(done => {
38-
env.close().then(() => { done() })
42+
env.close().then(() => { done() }).catch(e => {
43+
console.error(e)
44+
})
3945
})
4046

4147
it('simple query with a promise open-query-close-resolve var%', async function handler () {

Diff for: test/querycancel.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ describe('querycancel', function () {
1010
this.timeout(30000)
1111

1212
this.beforeEach(done => {
13-
env.open().then(() => done())
13+
env.open().then(() => {
14+
done()
15+
}).catch(e => {
16+
console.error(e)
17+
})
1418
})
1519

1620
this.afterEach(done => {
17-
env.close().then(() => done())
21+
env.close().then(() => { done() }).catch(e => {
22+
console.error(e)
23+
})
1824
})
1925

2026
it('use promise on query to cancel', async function handler () {

Diff for: test/querytimeout.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ describe('querytimeout', function () {
1212
this.timeout(30000)
1313

1414
this.beforeEach(done => {
15-
env.open().then(() => { done() })
15+
env.open().then(() => {
16+
done()
17+
}).catch(e => {
18+
console.error(e)
19+
})
1620
})
1721

1822
this.afterEach(done => {
19-
env.close().then(() => { done() })
23+
env.close().then(() => { done() }).catch(e => {
24+
console.error(e)
25+
})
2026
})
2127

2228
const waitProcDef = `alter PROCEDURE <name> (

Diff for: test/sproc.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ describe('sproc', function () {
1616
this.timeout(30000)
1717

1818
this.beforeEach(done => {
19-
env.open().then(() => { done() })
19+
env.open().then(() => {
20+
done()
21+
}).catch(e => {
22+
console.error(e)
23+
})
2024
})
2125

2226
this.afterEach(done => {
23-
env.close().then((e) => {
24-
done()
27+
env.close().then(() => { done() }).catch(e => {
28+
console.error(e)
2529
})
2630
})
2731

Diff for: test/table-builder.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ describe('table-builder.js', function () {
1616
this.timeout(30000)
1717

1818
this.beforeEach(done => {
19-
env.open().then(() => { done() })
19+
env.open().then(() => {
20+
done()
21+
}).catch(e => {
22+
console.error(e)
23+
})
2024
})
2125

2226
this.afterEach(done => {
23-
env.close().then(() => { done() })
27+
env.close().then(() => { done() }).catch(e => {
28+
console.error(e)
29+
})
2430
})
2531

2632
it('use table builder to bind to a table int, nvarchar(max)', async function handler () {

Diff for: test/tvp.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ describe('tvp', function () {
1010
this.timeout(30000)
1111

1212
this.beforeEach(done => {
13-
env.open().then(() => { done() })
13+
env.open().then(() => {
14+
done()
15+
}).catch(e => {
16+
console.error(e)
17+
})
1418
})
1519

1620
this.afterEach(done => {
17-
env.close().then(() => { done() })
21+
env.close().then(() => { done() }).catch(e => {
22+
console.error(e)
23+
})
1824
})
1925

2026
async function checkTxt (tableName, vec) {

Diff for: test/txn.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@ describe('txn', function () {
3030
this.timeout(30000)
3131

3232
this.beforeEach(done => {
33-
env.open().then(() => { done() })
33+
env.open().then(() => {
34+
done()
35+
}).catch(e => {
36+
console.error(e)
37+
})
3438
})
3539

3640
this.afterEach(done => {
37-
env.close().then(() => { done() })
41+
env.close().then(() => { done() }).catch(e => {
42+
console.error(e)
43+
})
3844
})
3945

4046
const txnTableDef = {

Diff for: test/userbind.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ describe('userbind', function () {
1616
this.timeout(30000)
1717

1818
this.beforeEach(done => {
19-
env.open().then(() => { done() })
19+
env.open().then(() => {
20+
done()
21+
}).catch(e => {
22+
console.error(e)
23+
})
2024
})
2125

2226
this.afterEach(done => {
23-
env.close().then(() => { done() })
27+
env.close().then(() => { done() }).catch(e => {
28+
console.error(e)
29+
})
2430
})
2531

2632
async function testUserBindAsync (params) {

Diff for: test/warnings.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@ describe('warning', function () {
1212
this.timeout(30000)
1313

1414
this.beforeEach(done => {
15-
env.open().then(() => { done() })
15+
env.open().then(() => {
16+
done()
17+
}).catch(e => {
18+
console.error(e)
19+
})
1620
})
1721

1822
this.afterEach(done => {
19-
env.close().then(() => { done() })
23+
env.close().then(() => { done() }).catch(e => {
24+
console.error(e)
25+
})
2026
})
2127

2228
const joinFailTestQry =

0 commit comments

Comments
 (0)