@@ -3,9 +3,10 @@ import type {
33 QuickSQLiteConnection ,
44 BatchQueryCommand ,
55} from 'react-native-quick-sqlite'
6- import { beforeEach , describe , it } from './MochaRNAdapter'
6+ import { beforeEach , describe , it } from './MochaRNAdapter'
77import chai from 'chai'
8- import { testDb as testDbInternal , resetTestDb } from './db'
8+ import { testDb as testDbInternal , resetTestDb } from './db'
9+ import { User } from '../model/User'
910
1011function isError ( e : unknown ) : e is Error {
1112 return e instanceof Error
@@ -129,7 +130,7 @@ export function registerUnitTests() {
129130 const age = chance . integer ( )
130131 const networth = chance . floating ( )
131132
132- await testDb . transaction ( tx => {
133+ await testDb . transaction ( ( tx ) => {
133134 const res = tx . execute (
134135 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
135136 [ id , name , age , networth ]
@@ -159,7 +160,7 @@ export function registerUnitTests() {
159160 const age = chance . integer ( )
160161 const networth = chance . floating ( )
161162
162- await testDb . transaction ( tx => {
163+ await testDb . transaction ( ( tx ) => {
163164 const res = tx . execute (
164165 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
165166 [ id , name , age , networth ]
@@ -198,7 +199,7 @@ export function registerUnitTests() {
198199 // ACT: Start multiple transactions to upsert and select the same record
199200 const promises = [ ]
200201 for ( let iteration = 1 ; iteration <= iterations ; iteration ++ ) {
201- const promised = testDb . transaction ( tx => {
202+ const promised = testDb . transaction ( ( tx ) => {
202203 // ACT: Upsert statement to create record / increment the value
203204 tx . execute (
204205 `
@@ -245,7 +246,7 @@ export function registerUnitTests() {
245246 const age = chance . integer ( )
246247 const networth = chance . floating ( )
247248
248- await testDb . transaction ( tx => {
249+ await testDb . transaction ( ( tx ) => {
249250 const res = tx . execute (
250251 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
251252 [ id , name , age , networth ]
@@ -283,7 +284,7 @@ export function registerUnitTests() {
283284 const age = chance . integer ( )
284285 const networth = chance . floating ( )
285286
286- await testDb . transaction ( tx => {
287+ await testDb . transaction ( ( tx ) => {
287288 try {
288289 tx . execute (
289290 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
@@ -319,7 +320,7 @@ export function registerUnitTests() {
319320 const age = chance . integer ( )
320321 const networth = chance . floating ( )
321322
322- await testDb . transaction ( tx => {
323+ await testDb . transaction ( ( tx ) => {
323324 tx . execute (
324325 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
325326 [ id , name , age , networth ]
@@ -347,7 +348,7 @@ export function registerUnitTests() {
347348 } )
348349
349350 it ( 'Transaction, rejects on invalid query' , async ( ) => {
350- const promised = testDb . transaction ( tx => {
351+ const promised = testDb . transaction ( ( tx ) => {
351352 tx . execute ( 'SELECT * FROM [tableThatDoesNotExist];' )
352353 } )
353354 // ASSERT: should return a promise that eventually rejects
@@ -364,8 +365,8 @@ export function registerUnitTests() {
364365
365366 it ( 'Transaction, handle async callback' , async ( ) => {
366367 let ranCallback = false
367- const promised = testDb . transaction ( async tx => {
368- await new Promise < void > ( done => {
368+ const promised = testDb . transaction ( async ( tx ) => {
369+ await new Promise < void > ( ( done ) => {
369370 setTimeout ( ( ) => done ( ) , 50 )
370371 } )
371372 tx . execute ( 'SELECT * FROM [User];' )
@@ -384,7 +385,7 @@ export function registerUnitTests() {
384385 const age = chance . integer ( )
385386 const networth = chance . floating ( )
386387
387- await testDb . transaction ( async tx => {
388+ await testDb . transaction ( async ( tx ) => {
388389 const res = await tx . executeAsync (
389390 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
390391 [ id , name , age , networth ]
@@ -415,7 +416,7 @@ export function registerUnitTests() {
415416 const networth = chance . floating ( )
416417
417418 try {
418- await testDb . transaction ( async tx => {
419+ await testDb . transaction ( async ( tx ) => {
419420 await tx . executeAsync (
420421 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
421422 [ id , name , age , networth ]
@@ -441,7 +442,7 @@ export function registerUnitTests() {
441442 const age = chance . integer ( )
442443 const networth = chance . floating ( )
443444
444- await testDb . transaction ( async tx => {
445+ await testDb . transaction ( async ( tx ) => {
445446 await tx . executeAsync (
446447 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
447448 [ id , name , age , networth ]
@@ -466,7 +467,7 @@ export function registerUnitTests() {
466467 const age = chance . integer ( )
467468 const networth = chance . floating ( )
468469
469- await testDb . transaction ( async tx => {
470+ await testDb . transaction ( async ( tx ) => {
470471 await tx . executeAsync (
471472 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
472473 [ id , name , age , networth ]
@@ -491,7 +492,7 @@ export function registerUnitTests() {
491492 // ACT: Start multiple async transactions to upsert and select the same record
492493 const promises = [ ]
493494 for ( let iteration = 1 ; iteration <= iterations ; iteration ++ ) {
494- const promised = testDb . transaction ( async tx => {
495+ const promised = testDb . transaction ( async ( tx ) => {
495496 // ACT: Upsert statement to create record / increment the value
496497 await tx . executeAsync (
497498 `
@@ -549,7 +550,7 @@ export function registerUnitTests() {
549550 } )
550551
551552 it ( 'Async transaction, rejects on invalid query' , async ( ) => {
552- const promised = testDb . transaction ( async tx => {
553+ const promised = testDb . transaction ( async ( tx ) => {
553554 await tx . executeAsync ( 'SELECT * FROM [tableThatDoesNotExist];' )
554555 } )
555556
@@ -592,7 +593,7 @@ export function registerUnitTests() {
592593
593594 const res = testDb . execute ( 'SELECT * FROM User' )
594595 expect ( res . rows ?. _array ) . to . eql ( [
595- { id : id1 , name : name1 , age : age1 , networth : networth1 } ,
596+ { id : id1 , name : name1 , age : age1 , networth : networth1 } ,
596597 {
597598 id : id2 ,
598599 name : name2 ,
@@ -628,7 +629,7 @@ export function registerUnitTests() {
628629
629630 const res = testDb . execute ( 'SELECT * FROM User' )
630631 expect ( res . rows ?. _array ) . to . eql ( [
631- { id : id1 , name : name1 , age : age1 , networth : networth1 } ,
632+ { id : id1 , name : name1 , age : age1 , networth : networth1 } ,
632633 {
633634 id : id2 ,
634635 name : name2 ,
0 commit comments