11import Driver from '../driver' ;
2- import {
3- destroyDriver ,
4- initDriver ,
5- TABLE
6- } from '../test-utils' ;
2+ import { destroyDriver , initDriver , TABLE } from '../test-utils' ;
73import { Column , Session , TableDescription } from '../table' ;
8- import { declareType , TypedData , Types } from "../types" ;
9- import { withRetries } from "../retries" ;
10-
4+ import { declareType , TypedData , Types } from '../types' ;
5+ import { withRetries } from '../retries' ;
116
127async function createTable ( session : Session ) {
138 await session . dropTable ( TABLE ) ;
149 await session . createTable (
1510 TABLE ,
1611 new TableDescription ( )
17- . withColumn ( new Column (
18- 'id' ,
19- Types . optional ( Types . UINT64 ) ,
20- ) )
21- . withColumn ( new Column (
22- 'field1' ,
23- Types . optional ( Types . TEXT ) ,
24- ) )
25- . withColumn ( new Column (
26- 'field2' ,
27- Types . optional ( Types . BYTES ) ,
28- ) )
29- . withColumn ( new Column (
30- 'field3' ,
31- Types . optional ( Types . YSON ) ,
32- ) )
33- . withPrimaryKey ( 'id' )
12+ . withColumn ( new Column ( 'id' , Types . optional ( Types . UINT64 ) ) )
13+ . withColumn ( new Column ( 'field1' , Types . optional ( Types . TEXT ) ) )
14+ . withColumn ( new Column ( 'field2' , Types . optional ( Types . BYTES ) ) )
15+ . withColumn ( new Column ( 'field3' , Types . optional ( Types . YSON ) ) )
16+ . withPrimaryKey ( 'id' ) ,
3417 ) ;
3518}
3619
@@ -65,15 +48,15 @@ class Row extends TypedData {
6548
6649export async function fillTableWithData ( session : Session , rows : Row [ ] ) {
6750 const query = `
68- DECLARE $data AS List<Struct<id: Uint64, field1: String , field2: String, field3: Yson>>;
51+ DECLARE $data AS List<Struct<id: Uint64, field1: Text , field2: String, field3: Yson>>;
6952
7053REPLACE INTO ${ TABLE }
7154SELECT * FROM AS_TABLE($data);` ;
7255
7356 await withRetries ( async ( ) => {
7457 const preparedQuery = await session . prepareQuery ( query ) ;
7558 await session . executeQuery ( preparedQuery , {
76- ' $data' : Row . asTypedCollection ( rows ) ,
59+ $data : Row . asTypedCollection ( rows ) ,
7760 } ) ;
7861 } ) ;
7962}
@@ -86,7 +69,7 @@ describe('bytestring identity', () => {
8669 id : 0 ,
8770 field1 : 'zero' ,
8871 field2 : Buffer . from ( 'half' ) ,
89- field3 : Buffer . from ( '<a=1>[3;%false]' )
72+ field3 : Buffer . from ( '<a=1>[3;%false]' ) ,
9073 } ) ,
9174 ] ;
9275
@@ -103,8 +86,8 @@ describe('bytestring identity', () => {
10386 } ) ;
10487 } ) ;
10588
106- it ( 'Types.STRING does not keep the original string in write-read cycle' , ( ) => {
107- expect ( actualRows [ 0 ] . field1 ) . not . toEqual ( 'zero' ) ;
89+ it ( 'Types.TEXT keeps the original string in write-read cycle' , ( ) => {
90+ expect ( actualRows [ 0 ] . field1 ) . toEqual ( 'zero' ) ;
10891 } ) ;
10992
11093 it ( 'Types.BYTES keeps the original string in write-read cycle' , ( ) => {
0 commit comments