Skip to content

Commit f7decc2

Browse files
author
Daniele Briggi
committed
fix(connection): suggestions
1 parent 6d0a24c commit f7decc2

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/drivers/connection-tls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export class SQLiteCloudTlsConnection extends SQLiteCloudConnection {
250250
}
251251

252252
/** Disconnect immediately, release connection, no events. */
253-
public close(): this {
253+
close(): this {
254254
if (this.socket) {
255255
this.socket.removeAllListeners()
256256
this.socket.destroy()

src/drivers/connection-ws.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class SQLiteCloudWebsocketConnection extends SQLiteCloudConnection {
3939

4040
this.socket.on('disconnect', (reason) => {
4141
this.close()
42-
callback?.call(this, new SQLiteCloudError('Disconnected', { errorCode: 'ERR_CONNECTION_DISCONNECTED', cause: reason }))
42+
callback?.call(this, new SQLiteCloudError('Disconnected', { errorCode: 'ERR_CONNECTION_ENDED', cause: reason }))
4343
})
4444

4545
this.socket.on('error', (error: Error) => {

test/connection-tls.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ it(
6060
const connection = new SQLiteCloudTlsConnection(configObj, error => {
6161
expect(error).toBeNull()
6262
expect(connection.connected).toBe(true)
63-
done()
6463
connection.close()
64+
done()
6565
})
6666
expect(connection).toBeDefined()
6767
},

test/connection-ws.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ describe('connection-ws', () => {
4040
let connection: SQLiteCloudWebsocketConnection | null = null
4141
connection = new SQLiteCloudWebsocketConnection(configObj, error => {
4242
expect(error).toBeNull()
43-
done()
4443
connection?.close()
44+
done()
4545
})
4646
})
4747

0 commit comments

Comments
 (0)