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
@@ -7,10 +7,12 @@ import {
|
||||
createUniqueLegacyTenantIpAddress,
|
||||
findLegacyTenantById,
|
||||
findLegacyTenantByIdOrSlug,
|
||||
findPlatformOperatorByUserId,
|
||||
getLegacyTenantMembershipsForUser,
|
||||
legacyTenantDetailsInclude,
|
||||
type LegacyTenantAccountReaderClient,
|
||||
type LegacyTenantIpAddressWriterClient,
|
||||
type PlatformOperatorReaderClient,
|
||||
} from "./accounts.server.js";
|
||||
|
||||
function createTenantClient(items: unknown[] = []): LegacyTenantAccountReaderClient {
|
||||
@@ -24,6 +26,32 @@ function createTenantClient(items: unknown[] = []): LegacyTenantAccountReaderCli
|
||||
}
|
||||
|
||||
describe("legacy account tenant reads", () => {
|
||||
it("revalidates a normalized operator identity through AdminUser", async () => {
|
||||
const client: PlatformOperatorReaderClient = {
|
||||
adminUser: {
|
||||
findUnique: vi.fn().mockResolvedValue({ id: "operator_1" }),
|
||||
},
|
||||
};
|
||||
|
||||
await expect(findPlatformOperatorByUserId(" operator_1 ", client)).resolves.toEqual({ userId: "operator_1" });
|
||||
expect(client.adminUser.findUnique).toHaveBeenCalledWith({
|
||||
where: { id: "operator_1" },
|
||||
select: { id: true },
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects malformed operator identifiers before querying AdminUser", async () => {
|
||||
const client: PlatformOperatorReaderClient = {
|
||||
adminUser: {
|
||||
findUnique: vi.fn(),
|
||||
},
|
||||
};
|
||||
|
||||
await expect(findPlatformOperatorByUserId(" ", client)).resolves.toBeNull();
|
||||
await expect(findPlatformOperatorByUserId(`operator_${"x".repeat(192)}`, client)).resolves.toBeNull();
|
||||
expect(client.adminUser.findUnique).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("fetches all tenants with the account API details shape", async () => {
|
||||
const client = createTenantClient([]);
|
||||
|
||||
@@ -56,7 +84,6 @@ describe("legacy account tenant reads", () => {
|
||||
icon: true,
|
||||
logo: true,
|
||||
deactivatedReason: true,
|
||||
types: true,
|
||||
active: true,
|
||||
theme: true,
|
||||
themeConfig: true,
|
||||
@@ -87,7 +114,6 @@ describe("legacy account tenant reads", () => {
|
||||
},
|
||||
include: {
|
||||
subscription: true,
|
||||
types: true,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user