From 4cab77ca3109e1552d525a82eb477698b986a12f Mon Sep 17 00:00:00 2001 From: Gioele Cantoni Date: Fri, 21 Feb 2025 13:01:25 +0100 Subject: [PATCH] fix test types --- package.json | 2 +- test/database.test.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f6d3861..33e2640 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sqlitecloud/drivers", - "version": "1.0.416", + "version": "1.0.417", "description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/test/database.test.ts b/test/database.test.ts index bdaefd2..b527df1 100644 --- a/test/database.test.ts +++ b/test/database.test.ts @@ -142,10 +142,11 @@ describe('Database.all', () => { 'select with one argument', done => { const chinook = getChinookDatabase() - chinook.all('SELECT * FROM tracks LIMIT ?', 1, (err: Error, rows: SQLiteCloudRowset) => { + chinook.all('SELECT * FROM tracks LIMIT ?', 1, (err: Error | null, rows: SQLiteCloudRow[] | undefined) => { expect(err).toBeNull() expect(rows).toBeDefined() - expect(rows[0]).toMatchObject({ + expect(rows).toHaveLength(1) + expect(rows && rows.length > 0 ? rows[0] : rows).toMatchObject({ AlbumId: 1, Bytes: 11170334, Composer: 'Angus Young, Malcolm Young, Brian Johnson', @@ -170,10 +171,11 @@ describe('Database.all', () => { 'select with one argument with array like ORMs', done => { const chinook = getChinookDatabase() - chinook.all('SELECT * FROM tracks LIMIT ?', [1], (err: Error, rows: SQLiteCloudRowset) => { + chinook.all('SELECT * FROM tracks LIMIT ?', [1], (err: Error | null, rows: SQLiteCloudRow[] | undefined) => { expect(err).toBeNull() expect(rows).toBeDefined() - expect(rows[0]).toMatchObject({ + expect(rows).toHaveLength(1) + expect(rows && rows.length > 0 ? rows[0] : rows).toMatchObject({ AlbumId: 1, Bytes: 11170334, Composer: 'Angus Young, Malcolm Young, Brian Johnson',