@@ -36,8 +36,8 @@ describe('Transaction', () => {
36
36
37
37
it ( 'should create a client with an empty temp table' , async ( ) => {
38
38
await withClient ( async ( client ) => {
39
- const { rowCount } = await client . query ( 'SELECT * FROM test_table' )
40
- assert . equal ( rowCount , 0 , 'Temp table should be empty on creation' )
39
+ const { rows } = await client . query ( 'SELECT * FROM test_table' )
40
+ assert . equal ( rows . length , 0 , 'Temp table should be empty on creation' )
41
41
} )
42
42
} )
43
43
@@ -51,15 +51,15 @@ describe('Transaction', () => {
51
51
52
52
// while inside this transaction, the changes are not visible outside
53
53
await withClient ( async ( innerClient ) => {
54
- const { rowCount } = await innerClient . query ( 'SELECT * FROM test_table' )
55
- assert . equal ( rowCount , 0 , 'Temp table should still be empty inside transaction' )
54
+ const { rows } = await innerClient . query ( 'SELECT * FROM test_table' )
55
+ assert . equal ( rows . length , 0 , 'Temp table should still be empty inside transaction' )
56
56
} )
57
+ } )
57
58
58
- // now that the transaction is committed, the changes are visible outside
59
- await withClient ( async ( innerClient ) => {
60
- const { rowCount } = await innerClient . query ( 'SELECT * FROM test_table' )
61
- assert . equal ( rowCount , 1 , 'Row should be inserted after transaction commits' )
62
- } )
59
+ // now that the transaction is committed, the changes are visible outside
60
+ await withClient ( async ( innerClient ) => {
61
+ const { rows } = await innerClient . query ( 'SELECT * FROM test_table' )
62
+ assert . equal ( rows . length , 1 , 'Row should be inserted after transaction commits' )
63
63
} )
64
64
} )
65
65
} )
@@ -76,8 +76,8 @@ describe('Transaction', () => {
76
76
}
77
77
78
78
// After rollback, the table should still be empty
79
- const { rowCount } = await client . query ( 'SELECT * FROM test_table' )
80
- assert . equal ( rowCount , 0 , 'Temp table should be empty after rollback' )
79
+ const { rows } = await client . query ( 'SELECT * FROM test_table' )
80
+ assert . equal ( rows . length , 0 , 'Temp table should be empty after rollback' )
81
81
} )
82
82
} )
83
83
@@ -113,8 +113,8 @@ describe('Transaction', () => {
113
113
}
114
114
115
115
// After rollback, the table should still be empty
116
- const { rowCount } = await pool . query ( 'SELECT * FROM test_table' )
117
- assert . equal ( rowCount , 0 , 'Temp table should be empty after pool rollback' )
116
+ const { rows } = await pool . query ( 'SELECT * FROM test_table' )
117
+ assert . equal ( rows . length , 0 , 'Temp table should be empty after pool rollback' )
118
118
} finally {
119
119
await pool . end ( )
120
120
}
0 commit comments