@@ -141,7 +141,7 @@ var data_6 = [{x: "š"}];
141141
142142var int_float_data = [ { int : 1 , float : 2.25 } , { int : 2 , float : 3.5 } , { int : 3 , float : 4.75 } , { int : 4 , float : 5.25 } ] ;
143143var int_float_string_data = [ { int : 1 , float : 2.25 , string : "a" } , { int : 2 , float : 3.5 , string : "b" } , { int : 3 , float : 4.75 , string : "c" } , { int : 4 , float : 5.25 , string : "d" } ] ;
144- var datetime_data = [ { datetime : + new Date ( ) , int : 1 } , { datetime : + new Date ( ) , int : 1 } , { datetime : + new Date ( ) , int : 2 } , { datetime : + new Date ( ) , int : 2 } ] ;
144+ var datetime_data = [ { datetime : new Date ( ) , int : 1 } , { datetime : new Date ( ) , int : 1 } , { datetime : new Date ( ) , int : 2 } , { datetime : new Date ( ) , int : 2 } ] ;
145145
146146// utility for checking typed arrays
147147function validate_typed_array ( typed_array , column_data ) {
@@ -207,7 +207,7 @@ module.exports = perspective => {
207207 var table = perspective . table ( int_float_data ) ;
208208 var view = table . view ( ) ;
209209 const result = await view . col_to_js_typed_array ( "int" ) ;
210- expect ( result . byteLength ) . toEqual ( 16 ) ;
210+ expect ( result [ 0 ] . byteLength ) . toEqual ( 16 ) ;
211211 view . delete ( ) ;
212212 table . delete ( ) ;
213213 } ) ;
@@ -216,16 +216,18 @@ module.exports = perspective => {
216216 var table = perspective . table ( int_float_data ) ;
217217 var view = table . view ( ) ;
218218 const result = await view . col_to_js_typed_array ( "float" ) ;
219- expect ( result . byteLength ) . toEqual ( 32 ) ;
219+ expect ( result [ 0 ] . byteLength ) . toEqual ( 32 ) ;
220220 view . delete ( ) ;
221221 table . delete ( ) ;
222222 } ) ;
223223
224224 it ( "Datetime, 0-sided view" , async function ( ) {
225225 var table = perspective . table ( datetime_data ) ;
226226 var view = table . view ( ) ;
227+ var schema = await view . schema ( ) ;
228+ expect ( schema ) . toEqual ( { datetime : "datetime" , int : "integer" } ) ;
227229 const result = await view . col_to_js_typed_array ( "datetime" ) ;
228- expect ( result . byteLength ) . toEqual ( 32 ) ;
230+ expect ( result [ 0 ] . byteLength ) . toEqual ( 32 ) ;
229231 view . delete ( ) ;
230232 table . delete ( ) ;
231233 } ) ;
@@ -238,7 +240,7 @@ module.exports = perspective => {
238240 } ) ;
239241 const result = await view . col_to_js_typed_array ( "int" ) ;
240242 // should include aggregate row
241- expect ( result . byteLength ) . toEqual ( 20 ) ;
243+ expect ( result [ 0 ] . byteLength ) . toEqual ( 20 ) ;
242244 view . delete ( ) ;
243245 table . delete ( ) ;
244246 } ) ;
@@ -250,7 +252,7 @@ module.exports = perspective => {
250252 aggregate : [ { op : "sum" , column : "int" } , { op : "sum" , column : "float" } ]
251253 } ) ;
252254 const result = await view . col_to_js_typed_array ( "float" ) ;
253- expect ( result . byteLength ) . toEqual ( 40 ) ;
255+ expect ( result [ 0 ] . byteLength ) . toEqual ( 40 ) ;
254256 view . delete ( ) ;
255257 table . delete ( ) ;
256258 } ) ;
@@ -262,7 +264,7 @@ module.exports = perspective => {
262264 aggregate : [ { op : "high" , column : "datetime" } ]
263265 } ) ;
264266 const result = await view . col_to_js_typed_array ( "datetime" ) ;
265- expect ( result . byteLength ) . toEqual ( 24 ) ;
267+ expect ( result [ 0 ] . byteLength ) . toEqual ( 24 ) ;
266268 view . delete ( ) ;
267269 table . delete ( ) ;
268270 } ) ;
@@ -275,7 +277,7 @@ module.exports = perspective => {
275277 aggregate : [ { op : "sum" , column : "int" } , { op : "sum" , column : "float" } ]
276278 } ) ;
277279 const result = await view . col_to_js_typed_array ( "3.5|int" ) ;
278- expect ( result . byteLength ) . toEqual ( 20 ) ;
280+ expect ( result [ 0 ] . byteLength ) . toEqual ( 20 ) ;
279281 view . delete ( ) ;
280282 table . delete ( ) ;
281283 } ) ;
@@ -288,7 +290,7 @@ module.exports = perspective => {
288290 aggregate : [ { op : "sum" , column : "int" } , { op : "sum" , column : "float" } ]
289291 } ) ;
290292 const result = await view . col_to_js_typed_array ( "3.5|float" ) ;
291- expect ( result . byteLength ) . toEqual ( 40 ) ;
293+ expect ( result [ 0 ] . byteLength ) . toEqual ( 40 ) ;
292294 view . delete ( ) ;
293295 table . delete ( ) ;
294296 } ) ;
@@ -298,7 +300,7 @@ module.exports = perspective => {
298300 var view = table . view ( { column_pivot : [ "float" ] } ) ;
299301 const result = await view . col_to_js_typed_array ( "3.5|int" ) ;
300302 // bytelength should not include the aggregate row
301- expect ( result . byteLength ) . toEqual ( 16 ) ;
303+ expect ( result [ 0 ] . byteLength ) . toEqual ( 16 ) ;
302304 view . delete ( ) ;
303305 table . delete ( ) ;
304306 } ) ;
@@ -307,31 +309,22 @@ module.exports = perspective => {
307309 var table = perspective . table ( int_float_data ) ;
308310 var view = table . view ( { column_pivot : [ "float" ] } ) ;
309311 const result = await view . col_to_js_typed_array ( "3.5|float" ) ;
310- expect ( result . byteLength ) . toEqual ( 32 ) ;
311- view . delete ( ) ;
312- table . delete ( ) ;
313- } ) ;
314-
315- it ( "Undefined for non-int/float columns" , async function ( ) {
316- var table = perspective . table ( int_float_string_data ) ;
317- var view = table . view ( ) ;
318- const result = await view . col_to_js_typed_array ( "string" ) ;
319- expect ( result ) . toBeUndefined ( ) ;
312+ expect ( result [ 0 ] . byteLength ) . toEqual ( 32 ) ;
320313 view . delete ( ) ;
321314 table . delete ( ) ;
322315 } ) ;
323316
324317 it ( "Symmetric output with to_columns, 0-sided" , async function ( ) {
325- let table = perspective . table ( int_float_string_data ) ;
318+ let table = perspective . table ( int_float_data ) ;
326319 let view = table . view ( ) ;
327320 let cols = await view . to_columns ( ) ;
328321
329322 for ( let col in cols ) {
330323 let ta = await view . col_to_js_typed_array ( col ) ;
331324 let column = cols [ col ] ;
332325 if ( ta !== undefined && column !== undefined ) {
333- expect ( ta . length ) . toEqual ( cols [ col ] . length ) ;
334- expect ( validate_typed_array ( ta , cols [ col ] ) ) . toEqual ( true ) ;
326+ expect ( ta [ 0 ] . length ) . toEqual ( cols [ col ] . length ) ;
327+ expect ( validate_typed_array ( ta [ 0 ] , cols [ col ] ) ) . toEqual ( true ) ;
335328 }
336329 }
337330 view . delete ( ) ;
@@ -350,8 +343,8 @@ module.exports = perspective => {
350343 let ta = await view . col_to_js_typed_array ( col ) ;
351344 let column = cols [ col ] ;
352345 if ( ta !== undefined && column !== undefined ) {
353- expect ( ta . length ) . toEqual ( cols [ col ] . length ) ;
354- expect ( validate_typed_array ( ta , cols [ col ] ) ) . toEqual ( true ) ;
346+ expect ( ta [ 0 ] . length ) . toEqual ( cols [ col ] . length ) ;
347+ expect ( validate_typed_array ( ta [ 0 ] , cols [ col ] ) ) . toEqual ( true ) ;
355348 }
356349 }
357350 view . delete ( ) ;
0 commit comments