Enforce cloud website limits by subscription tier

This commit is contained in:
Mike Cao committed 2026-05-26 20:45:07 -07:00
1 parent 7d4c68cebe
commit c41bf7c93e
4 files changed
+73 -10

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { describe, expect, test } from 'vitest';
import {
CLOUD_FREE_WEBSITE_LIMIT,
CLOUD_PRO_WEBSITE_LIMIT,
getCloudWebsiteLimit,
} from './subscription';
describe('getCloudWebsiteLimit', () => {
test('limits accounts without a subscription to the free website limit', () => {
expect(getCloudWebsiteLimit(null)).toBe(CLOUD_FREE_WEBSITE_LIMIT);
expect(getCloudWebsiteLimit({ hasSubscription: false })).toBe(CLOUD_FREE_WEBSITE_LIMIT);
});
test('limits Pro accounts to the Pro website limit', () => {
expect(getCloudWebsiteLimit({ hasSubscription: true, isPro: true })).toBe(
CLOUD_PRO_WEBSITE_LIMIT,
);
});
test('does not limit Business or no-billing accounts', () => {
expect(getCloudWebsiteLimit({ hasSubscription: true, isBusiness: true })).toBeNull();
expect(getCloudWebsiteLimit({ hasSubscription: true, isNoBilling: true })).toBeNull();
});
});