@@ -19,6 +19,7 @@ const mockDB = {
1919 } ;
2020 }
2121} ;
22+
2223describe ( 'IndexedDBFileManager' , ( ) => {
2324 let fileManager : IndexedDBFileManager ;
2425 let db : AsyncDuckDB ;
@@ -29,22 +30,23 @@ describe('IndexedDBFileManager', () => {
2930 tableName : 'taxi1' ,
3031 fileName : 'taxi1.parquet' ,
3132 buffer : new Uint8Array ( [ 1 , 2 , 3 ] ) ,
32- fileType : FILE_TYPES . PARQUET
33+ fileType : FILE_TYPES . PARQUET ,
34+ partitions : [ 'customer_oid=1' ] ,
3335 } ;
3436
3537 const fileBuffers = [
3638 {
3739 tableName : 'taxi1' ,
3840 fileName : 'taxi2.parquet' ,
3941 buffer : new Uint8Array ( [ 1 , 2 , 3 , 4 ] ) ,
40- fileType : FILE_TYPES . PARQUET
42+ fileType : FILE_TYPES . PARQUET ,
4143 } ,
4244 {
4345 tableName : 'taxi2' ,
4446 fileName : 'taxi3.parquet' ,
4547 buffer : new Uint8Array ( [ 1 , 2 , 3 , 4 , 5 ] ) ,
46- fileType : FILE_TYPES . PARQUET
47- }
48+ fileType : FILE_TYPES . PARQUET ,
49+ } ,
4850 ] ;
4951
5052 beforeAll ( ( ) => {
@@ -57,7 +59,7 @@ describe('IndexedDBFileManager', () => {
5759 } ,
5860 terminateDB : async ( ) => {
5961 return ;
60- }
62+ } ,
6163 } ;
6264 } ) ;
6365
@@ -71,7 +73,7 @@ describe('IndexedDBFileManager', () => {
7173 logger : log ,
7274 onEvent : ( event ) => {
7375 console . log ( event ) ;
74- }
76+ } ,
7577 } ) ;
7678
7779 await fileManager . initializeDB ( ) ;
@@ -91,7 +93,13 @@ describe('IndexedDBFileManager', () => {
9193 expect ( tableData1 . length ) . toBe ( 1 ) ;
9294 expect ( tableData1 [ 0 ] ) . toEqual ( {
9395 tableName : 'taxi1' ,
94- files : [ { fileName : fileBuffer . fileName , fileType : FILE_TYPES . PARQUET } ]
96+ files : [
97+ {
98+ fileName : fileBuffer . fileName ,
99+ fileType : FILE_TYPES . PARQUET ,
100+ partitions : fileBuffer . partitions ,
101+ } ,
102+ ] ,
95103 } ) ;
96104
97105 /**
@@ -112,7 +120,7 @@ describe('IndexedDBFileManager', () => {
112120 expect ( tableData2 . length ) . toBe ( 2 ) ;
113121 expect ( tableData2 [ 0 ] . files . map ( ( file ) => file . fileName ) ) . toEqual ( [
114122 'taxi1.parquet' ,
115- 'taxi2.parquet'
123+ 'taxi2.parquet' ,
116124 ] ) ;
117125
118126 /**
@@ -121,7 +129,7 @@ describe('IndexedDBFileManager', () => {
121129 expect ( fileBufferData2 . map ( ( file ) => file . fileName ) ) . toEqual ( [
122130 'taxi1.parquet' ,
123131 'taxi2.parquet' ,
124- 'taxi3.parquet'
132+ 'taxi3.parquet' ,
125133 ] ) ;
126134 } ) ;
127135
@@ -144,7 +152,7 @@ describe('IndexedDBFileManager', () => {
144152 // Register the same file with a different buffer
145153 await fileManager . registerFileBuffer ( {
146154 ...fileBuffer ,
147- buffer : new Uint8Array ( [ 1 ] )
155+ buffer : new Uint8Array ( [ 1 ] ) ,
148156 } ) ;
149157
150158 const fileBufferData2 = await indexedDB . files . toArray ( ) ;
@@ -156,14 +164,20 @@ describe('IndexedDBFileManager', () => {
156164 } ) ;
157165
158166 it ( 'should return the table data' , async ( ) => {
159- const fileData = await fileManager . getTableData ( 'taxi1' ) ;
167+ const fileData = await fileManager . getTableData ( {
168+ name : 'taxi1' ,
169+ partitions : fileBuffer . partitions ,
170+ } ) ;
160171
161172 expect ( fileData ) . toEqual ( {
162173 files : [
163- { fileName : 'taxi1.parquet' , fileType : 'parquet' } ,
164- { fileName : 'taxi2.parquet' , fileType : 'parquet' }
174+ {
175+ fileName : 'taxi1.parquet' ,
176+ fileType : 'parquet' ,
177+ partitions : fileBuffer . partitions ,
178+ } ,
165179 ] ,
166- tableName : 'taxi1'
180+ tableName : 'taxi1' ,
167181 } ) ;
168182 } ) ;
169183
0 commit comments