Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+59
@@ -0,0 +1,59 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { entitlementLimitTypes, evaluateProductAccess, featureKeys, productBlueprintIds } from "./index.js";
|
||||
|
||||
const crmSaas = productBlueprintIds.crmSaas;
|
||||
|
||||
describe("evaluateProductAccess denied-entitlement passthrough", () => {
|
||||
it("returns the missing-subscription entitlement under inherit without running the role gate", () => {
|
||||
const decision = evaluateProductAccess({
|
||||
blueprintId: crmSaas,
|
||||
featureKey: featureKeys.crmBasic,
|
||||
hasSubscription: false,
|
||||
limitType: entitlementLimitTypes.included,
|
||||
// A valid permission is supplied, but the denied entitlement must short-circuit before the gate.
|
||||
tenantRolePermissionNames: ["app.dashboard.view"],
|
||||
});
|
||||
|
||||
expect(decision).toMatchObject({
|
||||
allowed: false,
|
||||
reason: "missing-subscription",
|
||||
blueprintId: crmSaas,
|
||||
tenantOverride: "inherit",
|
||||
});
|
||||
expect(decision.requiredTenantRolePermission).toBeUndefined();
|
||||
});
|
||||
|
||||
it("passes an exhausted monthly quota straight through under an inherited override", () => {
|
||||
const decision = evaluateProductAccess({
|
||||
blueprintId: crmSaas,
|
||||
featureKey: featureKeys.supportTickets,
|
||||
hasSubscription: true,
|
||||
limitType: entitlementLimitTypes.monthly,
|
||||
limit: 50,
|
||||
used: 50,
|
||||
period: "2026-06",
|
||||
tenantRolePermissionNames: ["app.dashboard.view"],
|
||||
});
|
||||
|
||||
expect(decision).toMatchObject({
|
||||
allowed: false,
|
||||
reason: "monthly-exhausted",
|
||||
blueprintId: crmSaas,
|
||||
tenantOverride: "inherit",
|
||||
remaining: 0,
|
||||
period: "2026-06",
|
||||
});
|
||||
expect(decision.requiredTenantRolePermission).toBeUndefined();
|
||||
});
|
||||
|
||||
it("defaults the tenant override to inherit when none is supplied", () => {
|
||||
const decision = evaluateProductAccess({
|
||||
blueprintId: crmSaas,
|
||||
featureKey: featureKeys.crmBasic,
|
||||
hasSubscription: false,
|
||||
});
|
||||
|
||||
expect(decision.tenantOverride).toBe("inherit");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user