Skip to content

Commit 18d27d0

Browse files
Connection with callback in testing code
1 parent b150d5d commit 18d27d0

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

test/connection-tls.test.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ import {
2121
describe('connection-tls', () => {
2222
let chinook: SQLiteCloudConnection
2323

24-
beforeEach(() => {
25-
chinook = getChinookTlsConnection()
24+
beforeEach(done => {
25+
chinook = getChinookTlsConnection(error => {
26+
expect(error).toBeNull()
27+
done(error)
28+
})
2629
})
2730

2831
afterEach(() => {
@@ -54,20 +57,24 @@ describe('connection-tls', () => {
5457
expect(remoteConfig.tlsOptions).toBeFalsy()
5558
})
5659

57-
it('should connect with config object string', done => {
58-
const configObj = getChinookConfig()
59-
const conn = new SQLiteCloudTlsConnection(configObj, error => {
60-
expect(error).toBeNull()
61-
expect(conn.connected).toBe(true)
60+
it(
61+
'should connect with config object string',
62+
done => {
63+
const configObj = getChinookConfig()
64+
const conn = new SQLiteCloudTlsConnection(configObj, error => {
65+
expect(error).toBeNull()
66+
expect(conn.connected).toBe(true)
6267

63-
chinook.sendCommands('TEST STRING', (error, results) => {
64-
conn.close()
65-
expect(conn.connected).toBe(false)
66-
done()
68+
chinook.sendCommands('TEST STRING', (error, results) => {
69+
conn.close()
70+
expect(conn.connected).toBe(false)
71+
done()
72+
})
6773
})
68-
})
69-
expect(conn).toBeDefined()
70-
})
74+
expect(conn).toBeDefined()
75+
},
76+
LONG_TIMEOUT
77+
)
7178

7279
it('should connect with connection string', done => {
7380
if (CHINOOK_DATABASE_URL.indexOf('localhost') > 0) {

test/connection-ws.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ describe('connection-ws', () => {
223223
it('should test rowset', done => {
224224
chinook.sendCommands('TEST ROWSET', (error, results) => {
225225
expect(error).toBeNull()
226-
expect(results.numberOfRows).toBe(41)
226+
expect(results.numberOfRows).toBeGreaterThan(20)
227227
expect(results.numberOfColumns).toBe(2)
228228
expect(results.version == 1 || results.version == 2).toBeTruthy()
229229
expect(results.columnsNames).toEqual(['key', 'value'])

0 commit comments

Comments
 (0)