@@ -121,11 +121,35 @@ test('ES|QL helper', t => {
121
121
const result = await client . helpers . esql ( { query : 'FROM sample_data' } ) . toArrowTable ( )
122
122
t . ok ( result instanceof arrow . Table )
123
123
124
+ const testRecords = [
125
+ [
126
+ [ 'amount' , 4.900000095367432 ] ,
127
+ [ 'date' , 1729532586965 ]
128
+ ] ,
129
+ [
130
+ [ 'amount' , 8.199999809265137 ] ,
131
+ [ 'date' , 1729446186965 ] ,
132
+ ] ,
133
+ [
134
+ [ 'amount' , 15.5 ] ,
135
+ [ 'date' , 1729359786965 ] ,
136
+ ] ,
137
+ [
138
+ [ 'amount' , 9.899999618530273 ] ,
139
+ [ 'date' , 1729273386965 ] ,
140
+ ] ,
141
+ [
142
+ [ 'amount' , 13.899999618530273 ] ,
143
+ [ 'date' , 1729186986965 ] ,
144
+ ]
145
+ ]
146
+
147
+ let count = 0
124
148
const table = [ ...result ]
125
- t . same ( table [ 0 ] , [
126
- [ "amount" , 4.900000095367432 ] ,
127
- [ "date" , 1729532586965 ] ,
128
- ] )
149
+ for ( const record of table ) {
150
+ t . same ( record , testRecords [ count ] )
151
+ count ++
152
+ }
129
153
t . end ( )
130
154
} )
131
155
@@ -182,11 +206,36 @@ test('ES|QL helper', t => {
182
206
const result = await client . helpers . esql ( { query : 'FROM sample_data' } ) . toArrowReader ( )
183
207
t . ok ( result . isStream ( ) )
184
208
185
- const recordBatch = result . next ( ) . value
186
- t . same ( recordBatch . get ( 0 ) ?. toJSON ( ) , {
187
- amount : 4.900000095367432 ,
188
- date : 1729532586965 ,
189
- } )
209
+ const testRecords = [
210
+ {
211
+ amount : 4.900000095367432 ,
212
+ date : 1729532586965 ,
213
+ } ,
214
+ {
215
+ amount : 8.199999809265137 ,
216
+ date : 1729446186965 ,
217
+ } ,
218
+ {
219
+ amount : 15.5 ,
220
+ date : 1729359786965 ,
221
+ } ,
222
+ {
223
+ amount : 9.899999618530273 ,
224
+ date : 1729273386965 ,
225
+ } ,
226
+ {
227
+ amount : 13.899999618530273 ,
228
+ date : 1729186986965 ,
229
+ } ,
230
+ ]
231
+ let count = 0
232
+ for ( const recordBatch of result ) {
233
+ for ( const record of recordBatch ) {
234
+ t . same ( record . toJSON ( ) , testRecords [ count ] )
235
+ count ++
236
+ }
237
+ }
238
+
190
239
t . end ( )
191
240
} )
192
241
0 commit comments