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


##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -642,6 +642,116 @@ describe('Does transformProps transform series 
correctly', () => {
       'foo2, bar2': ['foo2', 'bar2'],
     });
   });
+
+  describe('Tooltip with long labels', () => {
+    it('should use axisValue for tooltip when available (richTooltip)', () => {
+      const longLabelData = [
+        {
+          data: [
+            {
+              'This is a very long category name that would normally be 
truncated': 100,
+              __timestamp: 599616000000,
+            },
+            {
+              'Another extremely long category name for testing purposes': 200,
+              __timestamp: 599916000000,
+            },
+          ],
+        },
+      ];
+
+      const chartProps = new ChartProps({
+        ...chartPropsConfig,
+        formData: {
+          ...formData,
+          richTooltip: true,
+        },
+        queriesData: longLabelData,
+      });
+
+      const transformedProps = transformProps(
+        chartProps as EchartsTimeseriesChartProps,
+      );
+
+      // Get the tooltip formatter function
+      const tooltipFormatter = (transformedProps.echartOptions as any).tooltip
+        .formatter;
+
+      // Simulate params from ECharts with axisValue containing full label
+      const mockParams = [
+        {
+          axisValue:
+            'This is a very long category name that would normally be 
truncated',
+          value: [599616000000, 100],
+          seriesName:
+            'This is a very long category name that would normally be 
truncated',
+        },
+      ];
+
+      // Call the formatter and check it uses the full label
+      const result = tooltipFormatter(mockParams);
+      expect(result).toContain(
+        'This is a very long category name that would normally be truncated',
+      );
+    });

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Incorrect Test Simulation</b></div>
   <div id="fix">
   
   The test 'should use axisValue for tooltip when available (richTooltip)' 
incorrectly simulates ECharts tooltip params by setting axisValue to the long 
label string, but axisValue should be the x-axis value (timestamp for 
timeseries). This misrepresents real tooltip behavior. The assertion only 
checks that the result contains the long label, which passes due to seriesName 
inclusion, not axisValue usage for the title. This violates the rule requiring 
tests to assert specific behavior logic directly.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #8a25ec</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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