bito-code-review[bot] commented on code in PR #38094:
URL: https://github.com/apache/superset/pull/38094#discussion_r2896088520
##########
superset-frontend/src/visualizations/TimeTable/components/FormattedNumber/FormattedNumber.test.tsx:
##########
@@ -39,14 +39,9 @@ test('should render with thousands separator', () => {
expect(screen.getByText('1,234,567')).toBeInTheDocument();
});
-test('should render zero when num is undefined', () => {
+test('should render null when num is undefined', () => {
render(<FormattedNumber format=".2f" />);
- expect(screen.getByText('0.00')).toBeInTheDocument();
-});
-
-test('should render zero without format when num is undefined', () => {
- render(<FormattedNumber />);
- expect(screen.getByText('0')).toBeInTheDocument();
+ expect(screen.getByText('null')).toBeInTheDocument();
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Inconsistent null display</b></div>
<div id="fix">
The FormattedNumber component currently falls back to a hardcoded 'null' for
undefined or invalid inputs. To be consistent with Superset's
Constants.NULL_DISPLAY ('N/A') and support translations, please update
FormattedNumber.tsx to use Constants.NULL_DISPLAY and adjust the tests to
expect 'N/A' instead of 'null'.
</div>
</div>
<small><i>Code Review Run #9b141a</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/src/visualizations/TimeTable/components/ValueCell/ValueCell.test.tsx:
##########
@@ -207,11 +78,7 @@ describe('ValueCell', () => {
};
const { container } = render(
- <ValueCell
- valueField="sales"
- column={columnWithBounds}
- reversedEntries={mockEntries}
- />,
+ <ValueCell value={300} column={columnWithBounds} />,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incomplete Test Assertion</b></div>
<div id="fix">
The test claims to verify color styling application but only checks
component rendering. To assert the behavior, add a check for the inner span's
color style, e.g., `const innerSpan =
container.querySelector('span[data-value="300"] span');
expect(innerSpan.style.color).toBeDefined();`. This ensures the test validates
the color logic rather than just presence.
</div>
</div>
<small><i>Code Review Run #9b141a</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]