From dfc39245403afb4855732e87c6a023d0c29ea01b Mon Sep 17 00:00:00 2001 From: Eric Gullickson <16152721+ericgullickson@users.noreply.github.com> Date: Wed, 11 Feb 2026 09:29:48 -0600 Subject: [PATCH] feat: add fuelLog.receiptScan tier gating with pro minTier (refs #131) Co-Authored-By: Claude Opus 4.6 --- backend/src/core/config/feature-tiers.ts | 5 ++++ .../core/config/tests/feature-tiers.test.ts | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/backend/src/core/config/feature-tiers.ts b/backend/src/core/config/feature-tiers.ts index f2b0fbd..f5d03a7 100644 --- a/backend/src/core/config/feature-tiers.ts +++ b/backend/src/core/config/feature-tiers.ts @@ -31,6 +31,11 @@ export const FEATURE_TIERS: Record = { name: 'VIN Decode', 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; /** diff --git a/backend/src/core/config/tests/feature-tiers.test.ts b/backend/src/core/config/tests/feature-tiers.test.ts index 4025e98..8112af2 100644 --- a/backend/src/core/config/tests/feature-tiers.test.ts +++ b/backend/src/core/config/tests/feature-tiers.test.ts @@ -34,6 +34,30 @@ describe('feature-tiers', () => { expect(feature.name).toBe('Scan for Maintenance Schedule'); 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', () => {