bito-code-review[bot] commented on code in PR #43515:
URL: https://github.com/apache/superset/pull/43515#discussion_r3854590703
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/controlPanel.test.ts:
##########
@@ -292,3 +292,31 @@ test('x_axis_time_format should be hidden for numeric
columns', () => {
false,
);
});
+
+const xMinIntervalControl: any = getControl('x_axis_min_interval');
+const yMinIntervalControl: any = getControl('y_axis_min_interval');
+
+test('should include the minimum interval controls for both axes', () => {
+ expect(xMinIntervalControl).toBeDefined();
+ expect(yMinIntervalControl).toBeDefined();
+ expect(xMinIntervalControl.config.default).toBeNull();
+ expect(yMinIntervalControl.config.default).toBeNull();
+ expect(xMinIntervalControl.config.renderTrigger).toBe(true);
+ expect(yMinIntervalControl.config.renderTrigger).toBe(true);
+});
+
+test('minimum interval controls follow the bar orientation', () => {
+ const xVisibility = xMinIntervalControl?.config?.visibility;
+ const yVisibility = yMinIntervalControl?.config?.visibility;
+ const vertical = mockBarControls('date', GenericDataType.Temporal);
+ const horizontal = mockBarControls(
+ 'date',
+ GenericDataType.Temporal,
+ OrientationType.Horizontal,
+ );
+
+ expect(xVisibility(vertical)).toBe(true);
+ expect(xVisibility(horizontal)).toBe(false);
+ expect(yVisibility(vertical)).toBe(false);
+ expect(yVisibility(horizontal)).toBe(true);
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Inverted test assertion</b></div>
<div id="fix">
The test assertions for `yVisibility` are inverted against the
implementation. The implementation in `controlPanel.tsx` line 260-261 uses
`isXAxis ? isHorizontal(controls) : isVertical(controls)` which returns true
when `isVertical` (orientation is Vertical) and `axis !== 'x'` — meaning the
y-axis min interval is shown when `controls.orientation.value ===
OrientationType.Vertical` (in vertical bar orientation). However, the test
expects `yVisibility(vertical) === true` and `yVisibility(horizontal) ===
false`, which is the opposite. This will cause the test suite to fail on every
run.
</div>
</div>
<small><i>Code Review Run #365d2a</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]