Files
outline/shared/utils/PlanHelper.test.ts
T
Tom Moor 95f31d361f fix: Owner selection and membership edge cases
- Remove document owners from the legacy plan
- Selecting yourself in the share picker only suggests other users that can
  be owners, and you are not suggested next to groups or guests
- Users that make themselves an owner through the API get the manage
  permission, so they are listed in the share panel
2026-11-20 11:55:16 -05:00

61 lines
1.8 KiB
TypeScript

import { Plan, PlanFeature } from "../types";
import { PlanHelper } from "./PlanHelper";
describe("PlanHelper", () => {
it("should define features for every plan", () => {
for (const plan of Object.values(Plan)) {
expect(PlanHelper.features[plan]).toBeDefined();
}
});
it("should not offer the legacy plan", () => {
expect(PlanHelper.plans).not.toContain(Plan.Legacy);
});
it("should check if a plan has a feature", () => {
expect(PlanHelper.hasFeature(Plan.Community, PlanFeature.AuditLog)).toBe(
false
);
expect(PlanHelper.hasFeature(Plan.Business, PlanFeature.AuditLog)).toBe(
true
);
});
it("should return the lowest plan with a feature", () => {
expect(PlanHelper.getMinimumPlan(PlanFeature.AuditLog)).toBe(Plan.Business);
});
it("should include AI answers in business and legacy plans", () => {
expect(PlanHelper.hasFeature(Plan.Standard, PlanFeature.AIAnswers)).toBe(
false
);
expect(PlanHelper.hasFeature(Plan.Business, PlanFeature.AIAnswers)).toBe(
true
);
expect(PlanHelper.hasFeature(Plan.Legacy, PlanFeature.AIAnswers)).toBe(
true
);
expect(PlanHelper.getMinimumPlan(PlanFeature.AIAnswers)).toBe(
Plan.Business
);
});
it("should include data attributes in business and above", () => {
expect(
PlanHelper.hasFeature(Plan.Standard, PlanFeature.DataAttributes)
).toBe(false);
expect(
PlanHelper.hasFeature(Plan.Business, PlanFeature.DataAttributes)
).toBe(true);
expect(
PlanHelper.hasFeature(Plan.Enterprise, PlanFeature.DataAttributes)
).toBe(true);
expect(PlanHelper.hasFeature(Plan.Legacy, PlanFeature.DataAttributes)).toBe(
false
);
expect(PlanHelper.getMinimumPlan(PlanFeature.DataAttributes)).toBe(
Plan.Business
);
});
});