You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-31 13:44:28 +03:00
Provide a more detailed error message than "No known servers" (#6048)
* Provide a more detailed error message than "No known servers" Signed-off-by: Aaron Raimist <aaron@raim.ist> * Fix PR since file was refactored Signed-off-by: Aaron Raimist <aaron@raim.ist> * Fix formatting Signed-off-by: Aaron Raimist <aaron@raim.ist> * lint Signed-off-by: Aaron Raimist <aaron@raim.ist> * Update src/stores/RoomViewStore.tsx Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> * Add example identifiers and a more detailed explanation Signed-off-by: Aaron Raimist <aaron@raim.ist> * Lint Signed-off-by: Aaron Raimist <aaron@raim.ist> * Lint Signed-off-by: Aaron Raimist <aaron@raim.ist> * Revert back to original wording (except s/alias/address) Alias was a better name imo but Element calls them addresses now so changed to be consistent. Signed-off-by: Aaron Raimist <aaron@raim.ist> * Prettier Signed-off-by: Aaron Raimist <aaron@raim.ist> * Fix ts error * Add snapshot test * Check the Modal props * Add test case to reach quality gate --------- Signed-off-by: Aaron Raimist <aaron@raim.ist> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Florian Duros <florianduros@element.io>
This commit is contained in:
@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { Room } from "matrix-js-sdk/src/matrix";
|
||||
import { mocked } from "jest-mock";
|
||||
import { MatrixError, Room } from "matrix-js-sdk/src/matrix";
|
||||
import { sleep } from "matrix-js-sdk/src/utils";
|
||||
|
||||
import { RoomViewStore } from "../../src/stores/RoomViewStore";
|
||||
@ -284,6 +285,29 @@ describe("RoomViewStore", function () {
|
||||
await viewCall();
|
||||
});
|
||||
|
||||
it("should display an error message when the room is unreachable via the roomId", async () => {
|
||||
// When
|
||||
// View and wait for the room
|
||||
dis.dispatch({ action: Action.ViewRoom, room_id: roomId });
|
||||
await untilDispatch(Action.ActiveRoomChanged, dis);
|
||||
// Generate error to display the expected error message
|
||||
const error = new MatrixError(undefined, 404);
|
||||
roomViewStore.showJoinRoomError(error, roomId);
|
||||
|
||||
// Check the modal props
|
||||
expect(mocked(Modal).createDialog.mock.calls[0][1]).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should display the generic error message when the roomId doesnt match", async () => {
|
||||
// When
|
||||
// Generate error to display the expected error message
|
||||
const error = new MatrixError({ error: "my 404 error" }, 404);
|
||||
roomViewStore.showJoinRoomError(error, roomId);
|
||||
|
||||
// Check the modal props
|
||||
expect(mocked(Modal).createDialog.mock.calls[0][1]).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe("when listening to a voice broadcast", () => {
|
||||
let voiceBroadcastPlayback: VoiceBroadcastPlayback;
|
||||
|
||||
|
Reference in New Issue
Block a user