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
+33
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { assertKnownFeatureKey, getFeatureGate, isFeatureKey } from "./index.js";
|
||||
|
||||
describe("feature gate edge cases", () => {
|
||||
it("includes the offending key in the assertion error message", () => {
|
||||
expect(() => assertKnownFeatureKey("totally-made-up")).toThrow(RangeError);
|
||||
expect(() => assertKnownFeatureKey("totally-made-up")).toThrow(/totally-made-up/);
|
||||
});
|
||||
|
||||
it("rejects the empty string as a feature key", () => {
|
||||
expect(isFeatureKey("")).toBe(false);
|
||||
expect(getFeatureGate("")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("returns the full registry item for a known key via the lookup overload", () => {
|
||||
const rateLimit = getFeatureGate("rate-limit-per-minute");
|
||||
|
||||
expect(rateLimit).toBeDefined();
|
||||
expect(rateLimit?.category).toBe("usage");
|
||||
// Rate limits are capped or off, never metered monthly.
|
||||
expect(rateLimit?.supportedLimitTypes).toEqual(["not-included", "max", "unlimited"]);
|
||||
expect(rateLimit?.supportedLimitTypes).not.toContain("monthly");
|
||||
});
|
||||
|
||||
it("constrains pure access features to the access limit family", () => {
|
||||
const knowledgeBaseRead = getFeatureGate("knowledge-base-read");
|
||||
|
||||
expect(knowledgeBaseRead?.supportedLimitTypes).toEqual(["not-included", "included", "unlimited"]);
|
||||
expect(knowledgeBaseRead?.supportedLimitTypes).not.toContain("max");
|
||||
expect(knowledgeBaseRead?.supportedLimitTypes).not.toContain("monthly");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user