@@ -19,6 +19,7 @@ const mockDB = {
19
19
} ;
20
20
}
21
21
} ;
22
+
22
23
describe ( 'IndexedDBFileManager' , ( ) => {
23
24
let fileManager : IndexedDBFileManager ;
24
25
let db : AsyncDuckDB ;
@@ -29,22 +30,23 @@ describe('IndexedDBFileManager', () => {
29
30
tableName : 'taxi1' ,
30
31
fileName : 'taxi1.parquet' ,
31
32
buffer : new Uint8Array ( [ 1 , 2 , 3 ] ) ,
32
- fileType : FILE_TYPES . PARQUET
33
+ fileType : FILE_TYPES . PARQUET ,
34
+ partitions : [ 'customer_oid=1' ] ,
33
35
} ;
34
36
35
37
const fileBuffers = [
36
38
{
37
39
tableName : 'taxi1' ,
38
40
fileName : 'taxi2.parquet' ,
39
41
buffer : new Uint8Array ( [ 1 , 2 , 3 , 4 ] ) ,
40
- fileType : FILE_TYPES . PARQUET
42
+ fileType : FILE_TYPES . PARQUET ,
41
43
} ,
42
44
{
43
45
tableName : 'taxi2' ,
44
46
fileName : 'taxi3.parquet' ,
45
47
buffer : new Uint8Array ( [ 1 , 2 , 3 , 4 , 5 ] ) ,
46
- fileType : FILE_TYPES . PARQUET
47
- }
48
+ fileType : FILE_TYPES . PARQUET ,
49
+ } ,
48
50
] ;
49
51
50
52
beforeAll ( ( ) => {
@@ -57,7 +59,7 @@ describe('IndexedDBFileManager', () => {
57
59
} ,
58
60
terminateDB : async ( ) => {
59
61
return ;
60
- }
62
+ } ,
61
63
} ;
62
64
} ) ;
63
65
@@ -71,7 +73,7 @@ describe('IndexedDBFileManager', () => {
71
73
logger : log ,
72
74
onEvent : ( event ) => {
73
75
console . log ( event ) ;
74
- }
76
+ } ,
75
77
} ) ;
76
78
77
79
await fileManager . initializeDB ( ) ;
@@ -91,7 +93,13 @@ describe('IndexedDBFileManager', () => {
91
93
expect ( tableData1 . length ) . toBe ( 1 ) ;
92
94
expect ( tableData1 [ 0 ] ) . toEqual ( {
93
95
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
+ ] ,
95
103
} ) ;
96
104
97
105
/**
@@ -112,7 +120,7 @@ describe('IndexedDBFileManager', () => {
112
120
expect ( tableData2 . length ) . toBe ( 2 ) ;
113
121
expect ( tableData2 [ 0 ] . files . map ( ( file ) => file . fileName ) ) . toEqual ( [
114
122
'taxi1.parquet' ,
115
- 'taxi2.parquet'
123
+ 'taxi2.parquet' ,
116
124
] ) ;
117
125
118
126
/**
@@ -121,7 +129,7 @@ describe('IndexedDBFileManager', () => {
121
129
expect ( fileBufferData2 . map ( ( file ) => file . fileName ) ) . toEqual ( [
122
130
'taxi1.parquet' ,
123
131
'taxi2.parquet' ,
124
- 'taxi3.parquet'
132
+ 'taxi3.parquet' ,
125
133
] ) ;
126
134
} ) ;
127
135
@@ -144,7 +152,7 @@ describe('IndexedDBFileManager', () => {
144
152
// Register the same file with a different buffer
145
153
await fileManager . registerFileBuffer ( {
146
154
...fileBuffer ,
147
- buffer : new Uint8Array ( [ 1 ] )
155
+ buffer : new Uint8Array ( [ 1 ] ) ,
148
156
} ) ;
149
157
150
158
const fileBufferData2 = await indexedDB . files . toArray ( ) ;
@@ -156,14 +164,20 @@ describe('IndexedDBFileManager', () => {
156
164
} ) ;
157
165
158
166
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
+ } ) ;
160
171
161
172
expect ( fileData ) . toEqual ( {
162
173
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
+ } ,
165
179
] ,
166
- tableName : 'taxi1'
180
+ tableName : 'taxi1' ,
167
181
} ) ;
168
182
} ) ;
169
183
0 commit comments