From 400b457edfb0a49e599c36e5fe46ff58ef9c4841 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 13 Oct 2022 14:59:15 +0100 Subject: [PATCH] Fix broken tests --- spec/unit/interactive-auth.spec.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/spec/unit/interactive-auth.spec.ts b/spec/unit/interactive-auth.spec.ts index 8005f1179..ba3eef89b 100644 --- a/spec/unit/interactive-auth.spec.ts +++ b/spec/unit/interactive-auth.spec.ts @@ -18,7 +18,7 @@ limitations under the License. import { MatrixClient } from "../../src/client"; import { logger } from "../../src/logger"; import { InteractiveAuth, AuthType } from "../../src/interactive-auth"; -import { MatrixError } from "../../src/http-api"; +import { HTTPError, MatrixError } from "../../src/http-api"; import { sleep } from "../../src/utils"; import { randomString } from "../../src/randomstring"; @@ -219,8 +219,7 @@ describe("InteractiveAuth", () => { params: { [AuthType.Password]: { param: "aa" }, }, - }); - err.httpStatus = 401; + }, 401); throw err; }); @@ -282,8 +281,7 @@ describe("InteractiveAuth", () => { params: { [AuthType.Password]: { param: "aa" }, }, - }); - err.httpStatus = 401; + }, 401); throw err; }); @@ -338,8 +336,7 @@ describe("InteractiveAuth", () => { params: { [AuthType.Password]: { param: "aa" }, }, - }); - err.httpStatus = 401; + }, 401); throw err; }); @@ -374,8 +371,7 @@ describe("InteractiveAuth", () => { }, error: "Mock Error 1", errcode: "MOCKERR1", - }); - err.httpStatus = 401; + }, 401); throw err; }); @@ -402,8 +398,7 @@ describe("InteractiveAuth", () => { doRequest.mockImplementation((authData) => { logger.log("request1", authData); expect(authData).toEqual({ "session": "sessionId" }); // has existing sessionId - const err = new Error('myerror'); - (err as any).httpStatus = 401; + const err = new HTTPError('myerror', 401); throw err; });