File tree Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -151,25 +151,49 @@ for (const {
151
151
t . is ( pool . idleCount , 1 ) ;
152
152
} ) ;
153
153
154
- test ( clientName + ': connection.query() returns expected results ' , async ( t ) => {
154
+ test ( clientName + ': connection.query() returns integers ' , async ( t ) => {
155
155
const pool = new Pool ( {
156
156
user : 'postgres' ,
157
157
} ) ;
158
158
159
159
const connection = await pool . connect ( ) ;
160
160
161
- const result = await connection . query ( 'SELECT 1' ) ;
161
+ const result = await connection . query ( 'SELECT 1::int4 AS foo ' ) ;
162
162
163
163
t . is ( result . rows . length , 1 ) ;
164
164
t . is ( result . command , 'SELECT' ) ;
165
165
t . like ( result . rows [ 0 ] ,
166
166
{
167
- '?column?' : 1 ,
167
+ foo : 1 ,
168
168
} ) ;
169
169
t . like ( result . fields [ 0 ] ,
170
170
{
171
171
dataTypeID : 23 ,
172
- name : '?column?' ,
172
+ name : 'foo' ,
173
+ } ) ;
174
+ } ) ;
175
+
176
+ test ( clientName + ': connection.query() returns integer arrays' , async ( t ) => {
177
+ const pool = new Pool ( {
178
+ user : 'postgres' ,
179
+ } ) ;
180
+
181
+ const connection = await pool . connect ( ) ;
182
+
183
+ const result = await connection . query ( 'SELECT ARRAY[1]::int4[] AS foo' ) ;
184
+
185
+ t . is ( result . rows . length , 1 ) ;
186
+ t . is ( result . command , 'SELECT' ) ;
187
+ t . like ( result . rows [ 0 ] ,
188
+ {
189
+ foo : [
190
+ 1 ,
191
+ ] ,
192
+ } ) ;
193
+ t . like ( result . fields [ 0 ] ,
194
+ {
195
+ dataTypeID : 1_007 ,
196
+ name : 'foo' ,
173
197
} ) ;
174
198
} ) ;
175
199
You can’t perform that action at this time.
0 commit comments