@@ -14,7 +14,7 @@ export default function registerTransactionUnitTests() {
1414 const age = chance . integer ( )
1515 const networth = chance . floating ( )
1616
17- await testDb . transaction ( ( tx ) => {
17+ await testDb . transaction ( async ( tx ) => {
1818 const res = tx . execute (
1919 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
2020 [ id , name , age , networth ] ,
@@ -44,7 +44,7 @@ export default function registerTransactionUnitTests() {
4444 const age = chance . integer ( )
4545 const networth = chance . floating ( )
4646
47- await testDb . transaction ( ( tx ) => {
47+ await testDb . transaction ( async ( tx ) => {
4848 const res = tx . execute (
4949 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
5050 [ id , name , age , networth ] ,
@@ -83,7 +83,7 @@ export default function registerTransactionUnitTests() {
8383 // ACT: Start multiple transactions to upsert and select the same record
8484 const promises = [ ]
8585 for ( let iteration = 1 ; iteration <= iterations ; iteration ++ ) {
86- const promised = testDb . transaction ( ( tx ) => {
86+ const promised = testDb . transaction ( async ( tx ) => {
8787 // ACT: Upsert statement to create record / increment the value
8888 tx . execute (
8989 `
@@ -130,7 +130,7 @@ export default function registerTransactionUnitTests() {
130130 const age = chance . integer ( )
131131 const networth = chance . floating ( )
132132
133- await testDb . transaction ( ( tx ) => {
133+ await testDb . transaction ( async ( tx ) => {
134134 const res = tx . execute (
135135 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
136136 [ id , name , age , networth ] ,
@@ -168,7 +168,7 @@ export default function registerTransactionUnitTests() {
168168 const age = chance . integer ( )
169169 const networth = chance . floating ( )
170170
171- await testDb . transaction ( ( tx ) => {
171+ await testDb . transaction ( async ( tx ) => {
172172 try {
173173 tx . execute (
174174 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
@@ -189,7 +189,7 @@ export default function registerTransactionUnitTests() {
189189 const age = chance . integer ( )
190190 const networth = chance . floating ( )
191191
192- await testDb . transaction ( ( tx ) => {
192+ await testDb . transaction ( async ( tx ) => {
193193 tx . execute (
194194 'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)' ,
195195 [ id , name , age , networth ] ,
@@ -211,14 +211,15 @@ export default function registerTransactionUnitTests() {
211211 await promised
212212 expect . fail ( DUMMY_ERROR_NAME )
213213 } catch ( e ) {
214+ console . log ( e )
214215 if ( isNitroSQLiteError ( e ) )
215216 expect ( e . message ) . to . include ( DUMMY_ERROR_MESSAGE )
216217 else expect . fail ( 'Should have thrown a valid NitroSQLiteError' )
217218 }
218219 } )
219220
220221 it ( 'Transaction, rejects on invalid query' , async ( ) => {
221- const promised = testDb . transaction ( ( tx ) => {
222+ const promised = testDb . transaction ( async ( tx ) => {
222223 tx . execute ( 'SELECT * FROM [tableThatDoesNotExist];' )
223224 } )
224225 // ASSERT: should return a promise that eventually rejects
0 commit comments