Skip to content

Commit 9c213aa

Browse files
Fix test checking for insert results #71
1 parent ea72ee2 commit 9c213aa

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

test/benchmark.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ describe('benchmark', () => {
101101
const startedOn = new Date()
102102
const result = await runScript(connection, database, testFile)
103103
const elapsedMs = new Date().getTime() - startedOn.getTime()
104-
console.debug(`${testFile} on ${database} took ${elapsedMs}ms\n`, result)
104+
105+
// console.debug(`${testFile} on ${database} took ${elapsedMs}ms\n`, result)
105106
}
106107

107108
await destroyDatabaseAsync(connection, database)

test/database.test.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ describe('Database.run', () => {
1414
it(
1515
'simple update',
1616
done => {
17-
// const updateSql = "UPDATE people SET name = 'Charlie Brown' WHERE id = 3; UPDATE people SET name = 'David Bowie' WHERE id = 4; "
1817
const updateSql = "UPDATE people SET name = 'Charlie Brown' WHERE id = 3; UPDATE people SET name = 'David Bowie' WHERE id = 4; "
1918

2019
// lambda callback would "hide" this
2120
function plainCallbackNotALambda(err: Error, results: any) {
2221
expect(err).toBeNull()
23-
expect(results).toBeUndefined()
22+
expect(results).toEqual({
23+
lastID: 20,
24+
changes: 1,
25+
totalChanges: 22,
26+
finalized: 1
27+
})
2428

2529
// Database.run should return number of rows modified and lastID
2630
// @ts-expect-error
@@ -74,7 +78,12 @@ describe('Database.run', () => {
7478
// lambda callback would "hide" this
7579
function plainCallbackNotALambdaTwo(err: Error, results: any) {
7680
expect(err).toBeNull()
77-
expect(results).toBeUndefined()
81+
expect(results).toEqual({
82+
lastID: 22,
83+
changes: 1,
84+
totalChanges: 22,
85+
finalized: 1
86+
})
7887

7988
// Database.run should return number of rows modified and lastID
8089
// @ts-expect-error

0 commit comments

Comments
 (0)