Merge branch 'v2/main' into v2/chore/2192-lint-core-react
This commit is contained in:
commit
5bc5977682
2 changed files with 986 additions and 29 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import { describe, it, expect } from "vitest";
|
||||
import {
|
||||
authRecoveryRestoredMessage,
|
||||
authRecoveryRetryFailedMessage,
|
||||
authRecoveryAbandonedMessage,
|
||||
emaStepUpFailureMessage,
|
||||
emaStepUpInProgressMessage,
|
||||
emaStepUpSuccessMessage,
|
||||
|
|
@ -208,6 +210,25 @@ describe("oauthUx resume/restore copy", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("authRecoveryRetryFailedMessage appends only a non-blank detail", () => {
|
||||
const base =
|
||||
"Could not continue the pending authorization. The Inspector will try again the next time this tab becomes active or the session reconnects.";
|
||||
expect(authRecoveryRetryFailedMessage()).toBe(base);
|
||||
expect(authRecoveryRetryFailedMessage(" ")).toBe(base);
|
||||
expect(authRecoveryRetryFailedMessage(" token endpoint 500 ")).toBe(
|
||||
`${base} (token endpoint 500)`,
|
||||
);
|
||||
});
|
||||
|
||||
it("authRecoveryAbandonedMessage promises no retry", () => {
|
||||
const base =
|
||||
"Could not continue the pending authorization, and the session it belonged to has ended. Reconnect to authorize again.";
|
||||
expect(authRecoveryAbandonedMessage()).toBe(base);
|
||||
expect(authRecoveryAbandonedMessage(" ")).toBe(base);
|
||||
expect(authRecoveryAbandonedMessage(" nope ")).toBe(`${base} (nope)`);
|
||||
expect(authRecoveryAbandonedMessage()).not.toContain("try again");
|
||||
});
|
||||
|
||||
it("oauthResumeAbandonedMessage reauth is retry-agnostic", () => {
|
||||
expect(
|
||||
oauthResumeAbandonedMessage("reauth", { recoverySource: "tool" }),
|
||||
|
|
|
|||
|
|
@ -2847,6 +2847,26 @@ describe("OAuthManager", () => {
|
|||
parseSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("does not navigate when the fallible setup rejects", async () => {
|
||||
// #2165: the web client drops its OAuth resume snapshot when this
|
||||
// rejects, which is only sound because the navigation resolves last.
|
||||
const params = createMockParams();
|
||||
storageOf(params).getClientInformation.mockRejectedValue(
|
||||
new Error("client information unreadable"),
|
||||
);
|
||||
const manager = new OAuthManager(params);
|
||||
|
||||
await expect(
|
||||
manager.beginInteractiveAuthorization(
|
||||
new URL("https://auth.example.com/authorize"),
|
||||
),
|
||||
).rejects.toThrow("client information unreadable");
|
||||
expect(
|
||||
params.initialConfig.navigation!.navigateToAuthorization,
|
||||
).not.toHaveBeenCalled();
|
||||
expect(params.dispatchOAuthAuthorizationRequired).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("throws when navigation is not configured", async () => {
|
||||
const params = createMockParams({
|
||||
initialConfig: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue