Skip to content

Commit 7fa7da8

Browse files
authored
fix #209 (orm): test types (#211)
1 parent 076e1d9 commit 7fa7da8

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sqlitecloud/drivers",
3-
"version": "1.0.416",
3+
"version": "1.0.417",
44
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",

test/database.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ describe('Database.all', () => {
142142
'select with one argument',
143143
done => {
144144
const chinook = getChinookDatabase()
145-
chinook.all('SELECT * FROM tracks LIMIT ?', 1, (err: Error, rows: SQLiteCloudRowset) => {
145+
chinook.all('SELECT * FROM tracks LIMIT ?', 1, (err: Error | null, rows: SQLiteCloudRow[] | undefined) => {
146146
expect(err).toBeNull()
147147
expect(rows).toBeDefined()
148-
expect(rows[0]).toMatchObject({
148+
expect(rows).toHaveLength(1)
149+
expect(rows && rows.length > 0 ? rows[0] : rows).toMatchObject({
149150
AlbumId: 1,
150151
Bytes: 11170334,
151152
Composer: 'Angus Young, Malcolm Young, Brian Johnson',
@@ -170,10 +171,11 @@ describe('Database.all', () => {
170171
'select with one argument with array like ORMs',
171172
done => {
172173
const chinook = getChinookDatabase()
173-
chinook.all('SELECT * FROM tracks LIMIT ?', [1], (err: Error, rows: SQLiteCloudRowset) => {
174+
chinook.all('SELECT * FROM tracks LIMIT ?', [1], (err: Error | null, rows: SQLiteCloudRow[] | undefined) => {
174175
expect(err).toBeNull()
175176
expect(rows).toBeDefined()
176-
expect(rows[0]).toMatchObject({
177+
expect(rows).toHaveLength(1)
178+
expect(rows && rows.length > 0 ? rows[0] : rows).toMatchObject({
177179
AlbumId: 1,
178180
Bytes: 11170334,
179181
Composer: 'Angus Young, Malcolm Young, Brian Johnson',

0 commit comments

Comments
 (0)