bito-code-review[bot] commented on code in PR #41184:
URL: https://github.com/apache/superset/pull/41184#discussion_r3557748333


##########
superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/tableRenders.test.tsx:
##########
@@ -103,35 +150,41 @@ test('TableRenderer renders row headers from pivot data', 
() => {
 });
 
 test('TableRenderer renders aggregated cell values', () => {
-  const props = buildDefaultProps();
+  const props = buildDefaultProps({
+    data: TAGGED_COUNT_DATA,
+    vals: ['value'],
+  });
   renderWithTheme(<TableRenderer {...props} />);
 
-  // With "Count" aggregator, each cell (row x col intersection) should
-  // contain "1" because each combination appears exactly once.
+  // Each leaf cell (row x col intersection) holds the DB-computed value "1".
   const cells = screen.getAllByRole('gridcell');
   const cellTexts = cells.map(cell => cell.textContent);
 
-  // There should be cell values of "1" for each of the four intersections
-  // (blue+circle, blue+square, red+circle, red+square).
-  const onesCount = cellTexts.filter(text => text === '1').length;
+  // There should be a "1" leaf cell for each of the four intersections
+  // (blue+circle, blue+square, red+circle, red+square). The default formatter
+  // renders with two decimals in this test (production applies the metric's
+  // own format).
+  const onesCount = cellTexts.filter(text => text === '1.00').length;

Review Comment:
   <!-- Bito Reply -->
   The suggestion is correct. The test uses `as any` to cast the 
`aggregatorTemplates.count()` result, which causes the formatter to default to 
`usFmtInt` (0 decimal places) instead of the expected 2-decimal format. To 
resolve this, you should either apply the correct formatter in the test or 
adjust the assertion to match the actual output.
   
   
**superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/tableRenders.test.tsx**
   ```
   // There should be a "1" leaf cell for each of the four intersections
     // (blue+circle, blue+square, red+circle, red+square). The default 
formatter
     // renders with two decimals in this test (production applies the metric's
     // own format).
     const onesCount = cellTexts.filter(text => text === '1.00').length;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to