From 500601ea853bee376cde7ccc5fe1ec98b33fdf15 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 14 Oct 2022 10:23:18 +0100 Subject: [PATCH] More tests to satisfy sonarcloud --- spec/unit/http-api/utils.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/unit/http-api/utils.spec.ts b/spec/unit/http-api/utils.spec.ts index 4dec92e91..b3d4e6848 100644 --- a/spec/unit/http-api/utils.spec.ts +++ b/spec/unit/http-api/utils.spec.ts @@ -140,6 +140,15 @@ describe("parseErrorResponse", () => { }, 500, "https://example.com")); }); + it("should set a sensible default error message on MatrixError", () => { + let err = new MatrixError(); + expect(err.message).toEqual("MatrixError: Unknown message"); + err = new MatrixError({ + error: "Oh no", + }); + expect(err.message).toEqual("MatrixError: Oh no"); + }); + it("should handle no type gracefully", () => { expect(parseErrorResponse({ headers: {