Secret Scan / scan (push) Successful in 8s
Build App (Preview) / compute-version (pull_request) Successful in 6s
Secret Scan / scan (pull_request) Successful in 14s
Build App (Preview) / create-release (pull_request) Successful in 2s
Build App (Preview) / test (pull_request) Successful in 9m36s
Build App (Preview) / build-macos (pull_request) Successful in 6m14s
Build App (Preview) / build-windows (pull_request) Successful in 11m11s
Build App (Preview) / build-linux (pull_request) Successful in 21m26s
Build App (Preview) / prune-previews (pull_request) Successful in 3s
- Runs carry an explicit kind (deploy, follow, repair, update, destroy, onboard, push, boundary); the admin-bundle offer after an AWS refusal keys on kind deploy/onboard, not the label, so a refused follow of an existing environment's deploy no longer offers a new-environment bundle. - looksDenied no longer matches a bare "explicit deny" (SCP and bucket policy denies aren't fixed by a bundle); the hint says it may need an admin. - The aws sso login hint breaks long profile names. - The "Not an admin?" disclosure shows a ▸/▾ marker like the Environments toggle. - Note: the previous commit's Modal footer flex-wrap is app-wide (every modal's buttons now wrap when the dialog is narrow); kept deliberately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
2.0 KiB
TypeScript
42 lines
2.0 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { awsErrorMessage, looksDenied, toAwsError } from "./aws-error";
|
|
|
|
describe("toAwsError", () => {
|
|
it("passes a tagged AwsError through", () => {
|
|
const e = { kind: "sso_expired", profile: "dev" };
|
|
expect(toAwsError(e)).toBe(e);
|
|
});
|
|
it("passes a quota error through with its message", () => {
|
|
const e = { kind: "quota_exceeded", message: "An account limit was reached" };
|
|
expect(toAwsError(e)).toBe(e);
|
|
expect(awsErrorMessage(toAwsError(e))).toBe("An account limit was reached");
|
|
});
|
|
it("wraps strings and Errors as other", () => {
|
|
expect(toAwsError("boom")).toEqual({ kind: "other", message: "boom" });
|
|
expect(toAwsError(new Error("bad"))).toEqual({ kind: "other", message: "bad" });
|
|
});
|
|
it("rejects unknown kinds, inherited names and null", () => {
|
|
expect(toAwsError({ kind: "nope" }).kind).toBe("other");
|
|
expect(toAwsError({ kind: "toString" }).kind).toBe("other");
|
|
expect(toAwsError(null).kind).toBe("other");
|
|
});
|
|
});
|
|
|
|
describe("access denied", () => {
|
|
it("shows AWS's message, naming the action when the message doesn't", () => {
|
|
expect(awsErrorMessage({ kind: "access_denied", action: "iam:CreateRole", message: "User: x is not authorized" })).toBe(
|
|
"AWS denied iam:CreateRole: User: x is not authorized",
|
|
);
|
|
expect(awsErrorMessage({ kind: "access_denied", action: "s3:PutObject", message: "denied s3:PutObject" })).toBe(
|
|
"AWS denied this request: denied s3:PutObject",
|
|
);
|
|
});
|
|
it("recognises refusals in OpenTofu output", () => {
|
|
expect(looksDenied("Error: creating IAM Role: AccessDenied: User is not authorized")).toBe(true);
|
|
expect(looksDenied("api error UnauthorizedOperation: You are not authorized")).toBe(true);
|
|
expect(looksDenied("Error: creating VPC: VpcLimitExceeded")).toBe(false);
|
|
expect(looksDenied(null)).toBe(false);
|
|
expect(looksDenied("blocked by an explicit deny in a service control policy")).toBe(false);
|
|
});
|
|
});
|