Copilot commented on code in PR #779:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/779#discussion_r3701512153


##########
web/src/pages/instance/__tests__/MessagePageAsyncState.test.tsx:
##########
@@ -121,6 +121,37 @@ describe('MessagePage async request ownership', () => {
     expect(screen.queryByText('late-after-reset')).not.toBeInTheDocument();
   });
 
+  it('surfaces unavailable message provider errors from query requests', async 
() => {
+    serviceMocks.queryMessages.mockRejectedValue(
+      new Error('Message query provider is not configured'),
+    );
+    const user = userEvent.setup();
+    renderPage();
+
+    await user.click(screen.getByRole('button', { name: /^search查询$/ }));
+
+    expect(await screen.findByText('Message query provider is not 
configured')).toBeInTheDocument();
+    expect(screen.getByRole('button', { name: /最近查询/ })).toBeDisabled();
+  });

Review Comment:
   This assertion makes the test dependent on `recentQueries` being empty at 
render time (i.e., localStorage having no prior history). If other tests (or 
previous runs in the same worker) seed `rocketmq-studio-message-query-history`, 
the "最近查询" button will be enabled and this test becomes flaky. Also, the 
requirement is to keep query history *unchanged* on failure, which is better 
verified by seeding history and asserting it remains the same after the 
rejected query.



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

Reply via email to