feat: add fuelLog.receiptScan tier gating with pro minTier (refs #131)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,11 @@ export const FEATURE_TIERS: Record<string, FeatureConfig> = {
|
|||||||
name: 'VIN Decode',
|
name: 'VIN Decode',
|
||||||
upgradePrompt: 'Upgrade to Pro to automatically decode VIN and populate vehicle details from the NHTSA database.',
|
upgradePrompt: 'Upgrade to Pro to automatically decode VIN and populate vehicle details from the NHTSA database.',
|
||||||
},
|
},
|
||||||
|
'fuelLog.receiptScan': {
|
||||||
|
minTier: 'pro',
|
||||||
|
name: 'Receipt Scan',
|
||||||
|
upgradePrompt: 'Upgrade to Pro to scan fuel receipts and auto-fill your fuel log entries.',
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,6 +34,30 @@ describe('feature-tiers', () => {
|
|||||||
expect(feature.name).toBe('Scan for Maintenance Schedule');
|
expect(feature.name).toBe('Scan for Maintenance Schedule');
|
||||||
expect(feature.upgradePrompt).toBeTruthy();
|
expect(feature.upgradePrompt).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('includes fuelLog.receiptScan feature', () => {
|
||||||
|
const feature = FEATURE_TIERS['fuelLog.receiptScan'];
|
||||||
|
expect(feature).toBeDefined();
|
||||||
|
expect(feature.minTier).toBe('pro');
|
||||||
|
expect(feature.name).toBe('Receipt Scan');
|
||||||
|
expect(feature.upgradePrompt).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('canAccessFeature - fuelLog.receiptScan', () => {
|
||||||
|
const featureKey = 'fuelLog.receiptScan';
|
||||||
|
|
||||||
|
it('denies access for free tier user', () => {
|
||||||
|
expect(canAccessFeature('free', featureKey)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('allows access for pro tier user', () => {
|
||||||
|
expect(canAccessFeature('pro', featureKey)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('allows access for enterprise tier user (inherits pro)', () => {
|
||||||
|
expect(canAccessFeature('enterprise', featureKey)).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getTierLevel', () => {
|
describe('getTierLevel', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user