Merge remote-tracking branch 'origin/develop' into hs/media-previews-server-config

This commit is contained in:
Half-Shot
2025-04-14 15:42:46 +01:00
7 changed files with 28 additions and 26 deletions

View File

@@ -321,7 +321,7 @@ describe("<MatrixChat />", () => {
await flushPromises();
const dialog = await screen.findByRole("dialog");
expect(within(dialog).getByText(errorMessage)).toBeInTheDocument();
await waitFor(() => expect(within(dialog).getByText(errorMessage)).toBeInTheDocument());
};
beforeEach(() => {
@@ -491,17 +491,17 @@ describe("<MatrixChat />", () => {
it("should persist login credentials", async () => {
getComponent({ realQueryParams });
await waitFor(() => expect(localStorage.getItem("mx_hs_url")).toEqual(homeserverUrl));
await waitFor(() => expect(localStorage.getItem("mx_device_id")).toEqual(deviceId));
expect(localStorage.getItem("mx_hs_url")).toEqual(homeserverUrl);
expect(localStorage.getItem("mx_user_id")).toEqual(userId);
expect(localStorage.getItem("mx_has_access_token")).toEqual("true");
expect(localStorage.getItem("mx_device_id")).toEqual(deviceId);
});
it("should store clientId and issuer in session storage", async () => {
getComponent({ realQueryParams });
await waitFor(() => expect(localStorage.getItem("mx_oidc_client_id")).toEqual(clientId));
expect(localStorage.getItem("mx_oidc_token_issuer")).toEqual(issuer);
await waitFor(() => expect(localStorage.getItem("mx_oidc_token_issuer")).toEqual(issuer));
});
it("should set logged in and start MatrixClient", async () => {

View File

@@ -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 () => {