Skip to content

Commit 87d1bab

Browse files
committed
test: if json parameters are serialized
1 parent 4a5f5b1 commit 87d1bab

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/postgres-bridge/bridge.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,27 @@ for (const {
321321
});
322322
});
323323

324+
test(clientName + ': connection.query() serializes json', async (t) => {
325+
const pool = new Pool({
326+
user: 'postgres',
327+
});
328+
329+
const connection = await pool.connect();
330+
331+
const result = await connection.query('SELECT $1::json AS foo', [
332+
{
333+
bar: 'baz',
334+
},
335+
]);
336+
337+
t.like(result.rows[0],
338+
{
339+
foo: {
340+
bar: 'baz',
341+
},
342+
});
343+
});
344+
324345
test(clientName + ': connection.query() interpolates parameters', async (t) => {
325346
const pool = new Pool({
326347
user: 'postgres',

0 commit comments

Comments
 (0)