print better errors in the search view instead of a blocking modal (#29724)
* print better errors in the search view instead of a blocking modal * update tests and i18n * fix unused variable * fix unused variable again
This commit is contained in:
@@ -247,7 +247,7 @@ describe("<RoomSearchView/>", () => {
|
||||
|
||||
await screen.findByRole("progressbar");
|
||||
await screen.findByText("Potato");
|
||||
expect(onUpdate).toHaveBeenCalledWith(false, expect.objectContaining({}));
|
||||
expect(onUpdate).toHaveBeenCalledWith(false, expect.objectContaining({}), null);
|
||||
|
||||
rerender(
|
||||
<MatrixClientContext.Provider value={client}>
|
||||
@@ -314,7 +314,8 @@ describe("<RoomSearchView/>", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should show modal if error is encountered", async () => {
|
||||
it("report error if one is encountered", async () => {
|
||||
const onUpdate = jest.fn();
|
||||
const deferred = defer<ISearchResults>();
|
||||
|
||||
render(
|
||||
@@ -326,14 +327,18 @@ describe("<RoomSearchView/>", () => {
|
||||
promise={deferred.promise}
|
||||
resizeNotifier={resizeNotifier}
|
||||
className="someClass"
|
||||
onUpdate={jest.fn()}
|
||||
onUpdate={onUpdate}
|
||||
/>
|
||||
</MatrixClientContext.Provider>,
|
||||
);
|
||||
deferred.reject(new Error("Some error"));
|
||||
deferred.reject("Some error");
|
||||
try {
|
||||
// Wait for RoomSearchView to process the promise
|
||||
await deferred.promise;
|
||||
} catch {}
|
||||
|
||||
await screen.findByText("Search failed");
|
||||
await screen.findByText("Some error");
|
||||
expect(onUpdate).toHaveBeenCalledWith(false, null, "Some error");
|
||||
expect(onUpdate).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("should combine search results when the query is present in multiple sucessive messages", async () => {
|
||||
|
||||
Reference in New Issue
Block a user