feat: unavailable addons support
This commit is contained in:
@@ -14,8 +14,8 @@ import type { AddonData, PricingPlans } from '../types';
|
||||
const pricing: PricingPlans = {
|
||||
device_price: 100,
|
||||
addons: [
|
||||
{ id: 'a', name: 'A', price: 50, free_threshold: -1 },
|
||||
{ id: 'b', name: 'B', price: 30, free_threshold: -1 },
|
||||
{ id: 'a', name: 'A', price: 50, free_threshold: -1, is_enabled: true },
|
||||
{ id: 'b', name: 'B', price: 30, free_threshold: -1, is_enabled: true },
|
||||
],
|
||||
};
|
||||
|
||||
@@ -38,8 +38,8 @@ describe('sumAddonPrices', () => {
|
||||
|
||||
it('makes addons free at their device threshold but keeps -1 paid', () => {
|
||||
const thresholdAddons: AddonData[] = [
|
||||
{ id: 'threshold', name: 'Threshold', price: 50, free_threshold: 6 },
|
||||
{ id: 'paid', name: 'Paid', price: 30, free_threshold: -1 },
|
||||
{ id: 'threshold', name: 'Threshold', price: 50, free_threshold: 6, is_enabled: true },
|
||||
{ id: 'paid', name: 'Paid', price: 30, free_threshold: -1, is_enabled: true },
|
||||
];
|
||||
|
||||
expect(sumAddonPrices(thresholdAddons, ['threshold', 'paid'], 5)).toBe(80);
|
||||
|
||||
Reference in New Issue
Block a user