Skip to content

Commit f4a5010

Browse files
committed
fix(pivot-table): correct expected combination order in percent_total pruning test
buildGroupbyCombinations iterates rows as the outer loop and columns as the inner loop, so when both the rows-collapsed and columns-collapsed levels are pruned in (the percent_total case), the rows-collapsed level pairs with every column prefix before the leaf row prefix does -- matching the row/col-only pruning tests directly above it. The new percent_total test had those two entries swapped; order carries no functional meaning downstream (transformProps/PivotData key off each row's own tags, not array position), so this fixes the expectation rather than the (correct) production code.
1 parent 490356d commit f4a5010

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/utilities.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,13 @@ test('pruning: percent_total forces the grand-total level even with both totals
407407
rowSubTotals: false,
408408
showValuesAs: ShowValuesAsEnum.PERCENT_OF_TOTAL,
409409
});
410+
// Rows is the outer loop and columns the inner loop (see
411+
// buildGroupbyCombinations's flatMap), so the rows-collapsed level pairs
412+
// with every column prefix before the leaf row prefix does.
410413
expect(combinations).toEqual([
411414
{ rows: [], columns: [] },
412-
{ rows: ['row1', 'row2'], columns: [] },
413415
{ rows: [], columns: ['col1', 'col2'] },
416+
{ rows: ['row1', 'row2'], columns: [] },
414417
{ rows: ['row1', 'row2'], columns: ['col1', 'col2'] },
415418
]);
416419
});

0 commit comments

Comments
 (0)