2026-06-13 16:22:01 +08:00
|
|
|
import type { EnterpriseFeature } from "@snapotter/enterprise";
|
2026-06-14 14:53:44 +08:00
|
|
|
import { vi } from "vitest";
|
2026-06-13 16:22:01 +08:00
|
|
|
|
|
|
|
|
export function mockEnterpriseFeatures(features: EnterpriseFeature[]) {
|
|
|
|
|
vi.doMock("@snapotter/enterprise", () => ({
|
2026-06-14 14:53:44 +08:00
|
|
|
isFeatureEnabled: (feature: string) => features.includes(feature as EnterpriseFeature),
|
2026-06-13 16:22:01 +08:00
|
|
|
getActiveLicense: () => ({
|
|
|
|
|
org: "test-org",
|
|
|
|
|
plan: "enterprise" as const,
|
|
|
|
|
features,
|
|
|
|
|
seats: 100,
|
2026-06-14 14:53:44 +08:00
|
|
|
expiresAt: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString(),
|
2026-06-13 16:22:01 +08:00
|
|
|
issuedAt: new Date().toISOString(),
|
|
|
|
|
}),
|
|
|
|
|
initEnterprise: vi.fn(),
|
|
|
|
|
loadS3Storage: vi.fn(),
|
|
|
|
|
ENTERPRISE_FEATURES: features,
|
|
|
|
|
PLAN_FEATURES: { team: [], enterprise: features },
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function mockNoEnterprise() {
|
|
|
|
|
vi.doMock("@snapotter/enterprise", () => ({
|
|
|
|
|
isFeatureEnabled: () => false,
|
|
|
|
|
getActiveLicense: () => null,
|
|
|
|
|
initEnterprise: vi.fn(),
|
|
|
|
|
loadS3Storage: vi.fn(),
|
|
|
|
|
ENTERPRISE_FEATURES: [],
|
|
|
|
|
PLAN_FEATURES: { team: [], enterprise: [] },
|
|
|
|
|
}));
|
|
|
|
|
}
|