Skip to content

Commit 2b143a0

Browse files
test: updated feature schema to include featureEnumOptions
BREAKING CHANGE: methods will use v3 of the API. New initSalable function to replace Salable class.
1 parent 7e9af6f commit 2b143a0

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

src/pricing-tables/v2/pricing-table-v2.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ describe('Pricing Table V2 Tests', () => {
1515

1616
it('getAll: should successfully fetch all pricing tables', async () => {
1717
const data = await salable.pricingTables.getOne(pricingTableUuid);
18-
console.dir(data, {depth: null});
1918
expect(data).toEqual(expect.objectContaining(PricingTableSchema));
2019
});
2120
});

src/products/v3/product-v3.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ describe('Products V3 Tests', () => {
147147
...ProductSchemaV3,
148148
uuid: data.productThree.uuid,
149149
slug: 'c-slug',
150-
productUuid: data.productThree.uuid,
151150
archivedAt: expect.any(String) as string,
152151
},
153152
],
@@ -156,10 +155,6 @@ describe('Products V3 Tests', () => {
156155
})
157156
})
158157

159-
it('getAll: should successfully fetch all products', async () => {
160-
const data = await salable.products.getAll();
161-
expect(data).toEqual(expect.arrayContaining([ProductSchemaV3]));
162-
});
163158
it('getOne: should successfully fetch a product', async () => {
164159
const data = await salable.products.getOne(productUuid);
165160
expect(data).toEqual(ProductSchemaV3);

src/schemas/v3/schemas-v3.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
import { FeatureV3, Invoice, LicenseV3, OrganisationPaymentIntegrationV3,
2-
PaginatedLicenses, PaginatedSubscription, PaginatedSubscriptionInvoice, PlanCurrency, PlanFeatureV3, PlanV3, PricingTableV3, ProductCurrency, ProductPricingTableV3, ProductV3, Subscription } from '../../types';
1+
import {
2+
FeatureEnumOption,
3+
FeatureV3,
4+
Invoice,
5+
LicenseV3,
6+
OrganisationPaymentIntegrationV3,
7+
PaginatedLicenses,
8+
PaginatedSubscription,
9+
PaginatedSubscriptionInvoice,
10+
PlanCurrency,
11+
PlanFeatureV3,
12+
PlanV3,
13+
PricingTableV3,
14+
ProductCurrency,
15+
ProductPricingTableV3,
16+
ProductV3,
17+
Subscription,
18+
} from '../../types';
319
import { EnumValueSchema, LicenseSchema, SubscriptionSchema } from '../v2/schemas-v2';
420

521
export const ProductSchemaV3: ProductV3 = {
@@ -41,7 +57,9 @@ export const PlanSchemaV3: PlanV3 = {
4157
isSubscribed: expect.toBeOneOf([expect.any(Boolean), undefined]),
4258
};
4359

44-
export const FeatureSchemaV3: FeatureV3 = {
60+
export const FeatureSchemaV3: FeatureV3 & {
61+
featureEnumOptions: FeatureEnumOption[]
62+
} = {
4563
defaultValue: expect.any(String),
4664
description: expect.toBeOneOf([expect.any(String), null]),
4765
displayName: expect.any(String),
@@ -54,6 +72,7 @@ export const FeatureSchemaV3: FeatureV3 = {
5472
valueType: expect.any(String),
5573
variableName: expect.any(String),
5674
visibility: expect.any(String),
75+
featureEnumOptions: expect.arrayContaining([EnumValueSchema]) as FeatureEnumOption[]
5776
};
5877

5978
export const PlanFeatureSchemaV3: PlanFeatureV3 = {

test-utils/scripts/create-salable-test-data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ const apiKeyScopesV3 = [
169169
'subscriptions:write',
170170
'pricing-tables:read',
171171
'plans:read',
172+
'features:read',
172173
'products:read',
173174
'sessions:write',
174175
'usage:read',

0 commit comments

Comments
 (0)