Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { PortalActorAttributionError, requireExactlyOneActor, requirePortalUserActor } from "./customer-portal-actor.js";
|
||||
|
||||
describe("customer portal actor attribution", () => {
|
||||
it("normalizes one internal actor", () => {
|
||||
expect(requireExactlyOneActor({ createdByUserId: " user_1 " })).toEqual({
|
||||
actorKind: "user",
|
||||
actorId: "user_1",
|
||||
createdByUserId: "user_1",
|
||||
createdByPortalUserId: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes one portal actor without a TenantUser fallback", () => {
|
||||
expect(requirePortalUserActor({ createdByPortalUserId: " portal_user_1 " })).toEqual({
|
||||
actorKind: "portal_user",
|
||||
actorId: "portal_user_1",
|
||||
createdByUserId: null,
|
||||
createdByPortalUserId: "portal_user_1",
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
{},
|
||||
{ createdByUserId: "", createdByPortalUserId: " " },
|
||||
{ createdByUserId: "user_1", createdByPortalUserId: "portal_user_1" },
|
||||
])("rejects missing or ambiguous actors: %o", (input) => {
|
||||
expect(() => requireExactlyOneActor(input)).toThrow(PortalActorAttributionError);
|
||||
});
|
||||
|
||||
it("rejects an internal actor at the portal mutation boundary", () => {
|
||||
expect(() => requirePortalUserActor({ createdByUserId: "synthetic-user" })).toThrowError(
|
||||
expect.objectContaining({ code: "portal_actor_exactly_one_required" }),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user