1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

Fix jest/valid-expects lints (#11238)

This commit is contained in:
Michael Telatynski
2023-07-13 16:19:44 +01:00
committed by GitHub
parent d7d60a3255
commit f5f31eb7d8
7 changed files with 27 additions and 26 deletions

View File

@ -114,7 +114,7 @@ describe("OIDC authorization", () => {
});
it("should throw when query params do not include state and code", async () => {
expect(async () => await completeOidcLogin({})).rejects.toThrow(
await expect(completeOidcLogin({})).rejects.toThrow(
"Invalid query parameters for OIDC native login. `code` and `state` are required.",
);
});

View File

@ -55,8 +55,8 @@ describe("getOidcClientId()", () => {
issuer: "https://issuerWithoutStaticClientId.org/",
registrationEndpoint: undefined,
};
expect(
async () => await getOidcClientId(authConfigWithoutRegistration, clientName, baseUrl, staticOidcClients),
await expect(
getOidcClientId(authConfigWithoutRegistration, clientName, baseUrl, staticOidcClients),
).rejects.toThrow(OidcError.DynamicRegistrationNotSupported);
// didn't try to register
expect(fetchMockJest).toHaveFetchedTimes(0);
@ -67,7 +67,7 @@ describe("getOidcClientId()", () => {
...delegatedAuthConfig,
registrationEndpoint: undefined,
};
expect(async () => await getOidcClientId(authConfigWithoutRegistration, clientName, baseUrl)).rejects.toThrow(
await expect(getOidcClientId(authConfigWithoutRegistration, clientName, baseUrl)).rejects.toThrow(
OidcError.DynamicRegistrationNotSupported,
);
// didn't try to register
@ -104,7 +104,7 @@ describe("getOidcClientId()", () => {
fetchMockJest.post(registrationEndpoint, {
status: 500,
});
expect(() => getOidcClientId(delegatedAuthConfig, clientName, baseUrl)).rejects.toThrow(
await expect(getOidcClientId(delegatedAuthConfig, clientName, baseUrl)).rejects.toThrow(
OidcError.DynamicRegistrationFailed,
);
});
@ -115,7 +115,7 @@ describe("getOidcClientId()", () => {
// no clientId in response
body: "{}",
});
expect(() => getOidcClientId(delegatedAuthConfig, clientName, baseUrl)).rejects.toThrow(
await expect(getOidcClientId(delegatedAuthConfig, clientName, baseUrl)).rejects.toThrow(
OidcError.DynamicRegistrationInvalid,
);
});