@@ -140,6 +140,26 @@ describe('SummaryCard', () => {
140140 expect ( html . match ( / # 1 / g) ) . toHaveLength ( 2 ) ;
141141 } ) ;
142142
143+ it ( 'shows a dash for a size total the formats cannot share' , ( ) => {
144+ const html = render ( {
145+ type : 'compressionSize' ,
146+ title : 'Compression Size Summary' ,
147+ rankings : [
148+ {
149+ name : 'parquet' ,
150+ minRatio : 1 ,
151+ ratio : 1 ,
152+ maxRatio : 1 ,
153+ compressionRatio : 4 ,
154+ totalBytes : null ,
155+ } ,
156+ ] ,
157+ explanation : 'e' ,
158+ } ) ;
159+ expect ( html ) . toContain ( 'class="score-runtime compression-size-value">—</span>' ) ;
160+ expect ( html ) . toContain ( 'class="compression-size-heading compression-size-total-unit"></span>' ) ;
161+ } ) ;
162+
143163 it ( 'renders nothing for a compression card with no rankings' , ( ) => {
144164 expect ( render ( { type : 'compression' , title : 't' , rankings : [ ] , explanation : 'e' } ) ) . toBe ( '' ) ;
145165 } ) ;
@@ -155,20 +175,23 @@ describe('SummaryCard', () => {
155175 ratio : 0.45 ,
156176 maxRatio : 1.55 ,
157177 compressionRatio : 8.25 ,
178+ totalBytes : 1_603_980_000 ,
158179 } ,
159180 {
160181 name : 'parquet' ,
161182 minRatio : 1 ,
162183 ratio : 1 ,
163184 maxRatio : 1 ,
164185 compressionRatio : 4.5 ,
186+ totalBytes : 1_428_150_000 ,
165187 } ,
166188 {
167189 name : 'lance' ,
168190 minRatio : 1.1 ,
169191 ratio : 1.2 ,
170192 maxRatio : 1.3 ,
171193 compressionRatio : null ,
194+ totalBytes : 2_500_000 ,
172195 } ,
173196 ] ,
174197 explanation : 'higher is better' ,
@@ -177,25 +200,42 @@ describe('SummaryCard', () => {
177200 expect ( html ) . toContain ( 'class="compression-size-scores"' ) ;
178201 expect ( html ) . toContain ( '>vs Arrow<' ) ;
179202 expect ( html ) . toContain ( '>vs Parquet<' ) ;
180- expect ( html ) . not . toContain ( 'GeoMean' ) ;
181- expect ( html . match ( / > M e a n < / g) ) . toHaveLength ( 1 ) ;
203+ expect ( html . match ( / > G e o M e a n < / g) ) . toHaveLength ( 1 ) ;
204+ expect ( html ) . not . toContain ( '>Mean<' ) ;
205+ expect ( html . match ( / > T o t a l < / g) ) . toHaveLength ( 1 ) ;
182206 expect ( html ) . toContain ( '>Min<' ) ;
183207 expect ( html ) . toContain ( '>Max<' ) ;
184208 expect ( html ) . not . toMatch ( / ⬇ ️ | 📊 | ⬆ ️ / ) ;
185209 expect ( html ) . toContain ( 'class="score-value compression-size-value">8.25x</span>' ) ;
186- expect ( html ) . toContain ( 'class="score-runtime compression-size-value">0.55x</span>' ) ;
210+ expect ( html ) . toContain (
211+ 'class="score-runtime compression-size-value compression-size-range">0.55x</span>' ,
212+ ) ;
187213 expect ( html ) . toContain ( 'class="score-value compression-size-value">0.45x</span>' ) ;
188- expect ( html ) . toContain ( 'class="score-runtime compression-size-value">1.55x</span>' ) ;
214+ expect ( html ) . toContain (
215+ 'class="score-runtime compression-size-value compression-size-range">1.55x</span>' ,
216+ ) ;
217+ // Phones hide Min and Max, never the geomean.
218+ expect ( html . match ( / c o m p r e s s i o n - s i z e - r a n g e / g) ) . toHaveLength ( 2 + 2 * 3 ) ;
189219 expect ( html . indexOf ( '8.25x' ) ) . toBeLessThan ( html . indexOf ( '0.55x' ) ) ;
220+ // Every total is in one unit, which the header names once.
221+ expect ( html ) . toContain (
222+ 'class="compression-size-heading compression-size-total-unit">MB</span>' ,
223+ ) ;
224+ const total = ( value : string ) =>
225+ `class="score-runtime compression-size-value"><span class="vx-sr-only">Total: </span>${ value } <span class="vx-sr-only"> MB</span></span>` ;
226+ expect ( html ) . toContain ( total ( '1,604.0' ) ) ;
227+ expect ( html ) . toContain ( total ( '1,428.2' ) ) ;
228+ expect ( html ) . toContain ( total ( '2.5' ) ) ;
229+ // Total sits between the format's name and its ratio to Arrow.
230+ expect ( html . indexOf ( '1,604.0' ) ) . toBeLessThan ( html . indexOf ( '8.25x' ) ) ;
190231 expect ( html ) . toContain ( 'parquet' ) ;
191232 expect ( html ) . toContain ( 'lance' ) ;
192233 expect ( html ) . toContain ( 'class="score-rank">#3</span>' ) ;
193234 expect ( html ) . toContain ( 'class="score-value compression-size-value">—</span>' ) ;
194235 expect ( html ) . toContain (
195- 'class="vx-sr-only">vortex: minimum 0.55x, mean 0.45x, maximum 1.55x</span>' ,
236+ 'class="vx-sr-only">vortex: minimum 0.55x, geometric mean 0.45x, maximum 1.55x</span>' ,
196237 ) ;
197238 expect ( html ) . toContain ( 'aria-hidden="true"' ) ;
198- expect ( html ) . not . toContain ( 'GB' ) ;
199239 } ) ;
200240
201241 it ( 'renders a queryBenchmark card with scores and total runtimes' , ( ) => {
@@ -264,8 +304,22 @@ describe('SummaryCard', () => {
264304 type : 'compressionSize' ,
265305 title : 'Compression Size Summary' ,
266306 rankings : [
267- { name : 'vortex-file-compressed' , minRatio : 1 , ratio : 1 , maxRatio : 1 , compressionRatio : 8 } ,
268- { name : 'lance' , minRatio : 1 , ratio : 1 , maxRatio : 1 , compressionRatio : 2 } ,
307+ {
308+ name : 'vortex-file-compressed' ,
309+ minRatio : 1 ,
310+ ratio : 1 ,
311+ maxRatio : 1 ,
312+ compressionRatio : 8 ,
313+ totalBytes : 100 ,
314+ } ,
315+ {
316+ name : 'lance' ,
317+ minRatio : 1 ,
318+ ratio : 1 ,
319+ maxRatio : 1 ,
320+ compressionRatio : 2 ,
321+ totalBytes : 200 ,
322+ } ,
269323 ] ,
270324 explanation : 'e' ,
271325 } ) ;
0 commit comments