Skip to content

Commit 74f4336

Browse files
committed
fix: ignore txStatus tests in native mode
1 parent 287728b commit 74f4336

1 file changed

Lines changed: 67 additions & 64 deletions

File tree

packages/pg/test/integration/client/txstatus-tests.js

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,75 +4,78 @@ const suite = new helper.Suite()
44
const pg = helper.pg
55
const assert = require('assert')
66

7-
suite.test('txStatus tracking', function (done) {
8-
const client = new pg.Client()
9-
client.connect(
10-
assert.success(function () {
11-
// Run a simple query to initialize txStatus
12-
client.query(
13-
'SELECT 1',
14-
assert.success(function () {
15-
// Test 1: Initial state after query (should be idle)
16-
assert.equal(client._txStatus, 'I', 'should start in idle state')
7+
// txStatus tracking is not implemented in native client
8+
if (!helper.args.native) {
9+
suite.test('txStatus tracking', function (done) {
10+
const client = new pg.Client()
11+
client.connect(
12+
assert.success(function () {
13+
// Run a simple query to initialize txStatus
14+
client.query(
15+
'SELECT 1',
16+
assert.success(function () {
17+
// Test 1: Initial state after query (should be idle)
18+
assert.equal(client._txStatus, 'I', 'should start in idle state')
1719

18-
// Test 2: BEGIN transaction
19-
client.query(
20-
'BEGIN',
21-
assert.success(function () {
22-
assert.equal(client._txStatus, 'T', 'should be in transaction state')
20+
// Test 2: BEGIN transaction
21+
client.query(
22+
'BEGIN',
23+
assert.success(function () {
24+
assert.equal(client._txStatus, 'T', 'should be in transaction state')
2325

24-
// Test 3: COMMIT
25-
client.query(
26-
'COMMIT',
27-
assert.success(function () {
28-
assert.equal(client._txStatus, 'I', 'should return to idle after commit')
26+
// Test 3: COMMIT
27+
client.query(
28+
'COMMIT',
29+
assert.success(function () {
30+
assert.equal(client._txStatus, 'I', 'should return to idle after commit')
2931

30-
client.end(done)
31-
})
32-
)
33-
})
34-
)
35-
})
36-
)
37-
})
38-
)
39-
})
32+
client.end(done)
33+
})
34+
)
35+
})
36+
)
37+
})
38+
)
39+
})
40+
)
41+
})
4042

41-
suite.test('txStatus error state', function (done) {
42-
const client = new pg.Client()
43-
client.connect(
44-
assert.success(function () {
45-
// Run a simple query to initialize txStatus
46-
client.query(
47-
'SELECT 1',
48-
assert.success(function () {
49-
client.query(
50-
'BEGIN',
51-
assert.success(function () {
52-
// Execute invalid SQL to trigger error state
53-
client.query('INVALID SQL SYNTAX', function (err) {
54-
assert(err, 'should receive error from invalid query')
43+
suite.test('txStatus error state', function (done) {
44+
const client = new pg.Client()
45+
client.connect(
46+
assert.success(function () {
47+
// Run a simple query to initialize txStatus
48+
client.query(
49+
'SELECT 1',
50+
assert.success(function () {
51+
client.query(
52+
'BEGIN',
53+
assert.success(function () {
54+
// Execute invalid SQL to trigger error state
55+
client.query('INVALID SQL SYNTAX', function (err) {
56+
assert(err, 'should receive error from invalid query')
5557

56-
// Issue a sync query to ensure ReadyForQuery has been processed
57-
// This guarantees _txStatus has been updated
58-
client.query('SELECT 1', function () {
59-
// This callback fires after ReadyForQuery is processed
60-
assert.equal(client._txStatus, 'E', 'should be in error state')
58+
// Issue a sync query to ensure ReadyForQuery has been processed
59+
// This guarantees _txStatus has been updated
60+
client.query('SELECT 1', function () {
61+
// This callback fires after ReadyForQuery is processed
62+
assert.equal(client._txStatus, 'E', 'should be in error state')
6163

62-
// Rollback to recover
63-
client.query(
64-
'ROLLBACK',
65-
assert.success(function () {
66-
assert.equal(client._txStatus, 'I', 'should return to idle after rollback from error')
67-
client.end(done)
68-
})
69-
)
64+
// Rollback to recover
65+
client.query(
66+
'ROLLBACK',
67+
assert.success(function () {
68+
assert.equal(client._txStatus, 'I', 'should return to idle after rollback from error')
69+
client.end(done)
70+
})
71+
)
72+
})
7073
})
7174
})
72-
})
73-
)
74-
})
75-
)
76-
})
77-
)
78-
})
75+
)
76+
})
77+
)
78+
})
79+
)
80+
})
81+
}

0 commit comments

Comments
 (0)