Copilot commented on code in PR #871:
URL:
https://github.com/apache/rocketmq-dashboard/pull/871#discussion_r3705163990
##########
web/src/pages/studio/__tests__/BrokerCluster.test.tsx:
##########
@@ -183,12 +183,14 @@ describe('BrokerCluster Page', () => {
expect(restartButtons.length).toBeGreaterThan(0);
});
- it('should fall back to mock data when the API fails', async () => {
+ it('does not show mock infrastructure data when the API fails', async () => {
vi.mocked(listClusters).mockRejectedValueOnce(new Error('network error'));
renderWithProviders(<BrokerCluster />);
- // Initial state holds the mock fallback rows
await waitFor(() => {
- expect(screen.getByText('broker-a')).toBeInTheDocument();
+ expect(listClusters).toHaveBeenCalledTimes(1);
});
+ expect(screen.queryByText('broker-a')).not.toBeInTheDocument();
+ expect(screen.queryByText('broker-b')).not.toBeInTheDocument();
+ expect(screen.queryByText('proxy-a')).not.toBeInTheDocument();
});
Review Comment:
This test asserts absence of a couple of broker/proxy mock nodes, but it
doesn't cover the full regression surface described in the PR (Broker +
NameServer + Proxy). Consider also asserting that a representative NameServer
mock row (e.g., 'nameserver-a') is not rendered, and add an assertion that the
API failure is still reported to the user (e.g., an error
banner/toast/message), to ensure the failure path both avoids mock topology and
still surfaces the error.
--
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]