Skip to content

Commit bd86514

Browse files
committed
Add another test
1 parent 389d5d8 commit bd86514

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/transactions.js

+13
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,17 @@ describe('transactions', () => {
2727
await client.query('ALTER TABLE foobar ADD COLUMN name TEXT')
2828
await client.end()
2929
})
30+
31+
it.only('can execute multiple statements in a transaction if no data', async () => {
32+
const client = new pg.Client()
33+
await client.connect()
34+
await client.query('begin')
35+
// create a cursor that has no data response
36+
const createText = 'CREATE TEMP TABLE foobar(id SERIAL PRIMARY KEY)'
37+
const cursor = client.query(new Cursor(createText))
38+
const err = await new Promise(resolve => cursor.read(100, resolve))
39+
assert.ifError(err)
40+
await client.query('ALTER TABLE foobar ADD COLUMN name TEXT')
41+
await client.end()
42+
})
3043
})

0 commit comments

Comments
 (0)