bito-code-review[bot] commented on code in PR #38126:
URL: https://github.com/apache/superset/pull/38126#discussion_r3652117829
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -399,7 +402,9 @@ describe('EchartsTimeseries transformProps', () => {
result.echartOptions.series as SeriesOption[] | undefined
)?.find((s: SeriesOption) => s.name === 'My Formula');
expect(formulaSeries).toBeDefined();
- const firstDataPoint = (formulaSeries!.data as [number, number][])[0];
+ const series = formulaSeries as SeriesOption;
+ const data = series.data as [number, number][];
+ const firstDataPoint = data[0];
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing array length validation</b></div>
<div id="fix">
The horizontal orientation test is missing the `data.length > 0` validation
that exists in the vertical orientation test (line 325). Without this guard,
accessing `data[0]` on an empty array would throw an uncaught exception rather
than a descriptive test failure.
</div>
</div>
<small><i>Code Review Run #9a943e</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
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -399,7 +402,9 @@ describe('EchartsTimeseries transformProps', () => {
result.echartOptions.series as SeriesOption[] | undefined
)?.find((s: SeriesOption) => s.name === 'My Formula');
expect(formulaSeries).toBeDefined();
- const firstDataPoint = (formulaSeries!.data as [number, number][])[0];
+ const series = formulaSeries as SeriesOption;
+ const data = series.data as [number, number][];
+ const firstDataPoint = data[0];
expect(firstDataPoint).toBeDefined();
expect(firstDataPoint[0]).toBe(firstDataPoint[1] * 2);
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Inverted assertion in test</b></div>
<div id="fix">
The formula annotation assertion on line 409 is inverted. It checks `x === y
* 2` (index 0 equals index 1 multiplied by 2) when it should check `y === x *
2` (index 1 equals index 0 multiplied by 2). This causes the test to always
fail for the `x*2` formula.
</div>
</div>
<small><i>Code Review Run #9a943e</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]