Skip to content

Commit

Permalink
feat: update with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
CarinaDraganJW committed Sep 23, 2024
2 parents de1224d + 0e51bc4 commit b048b40
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-unit-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
APP_API_SECRET: dummy_secret
APP_STRIPE_SECRET: dummy_stripe_secret
APP_BIND_ADDR: localhost
APP_BIND_PORT: 8080
APP_BIND_PORT: 3001
APP_ACCESS_CONTROL_API_HOST: https://test-cdn.jwplayer.com
APP_SIMS_API_HOST: https://test-sims.jwplayer.com
10 changes: 8 additions & 2 deletions packages/common/types/plans.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
type AccessOptions = {
drm_policy_id: string;
include_tags: string[] | null;
exclude_tags: string[] | null;
include_custom_params: string[] | null;
exclude_custom_params: string[] | null;
};

type PlanExternalProviders = {
Expand All @@ -15,10 +19,12 @@ export type AccessControlPlan = {

export type Plan = {
id: string;
original_id: number;
exp: number;
access_model: 'free' | 'freeauth' | 'svod';
access: AccessOptions;
metadata: {
name: string;
access: AccessOptions;
access_model: 'free' | 'freeauth' | 'svod';
external_providers: PlanExternalProviders;
};
};
Expand Down
74 changes: 54 additions & 20 deletions platforms/access-bridge/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,40 @@ export const VIEWER: Viewer = {
};

// Plan mock creation function
const createMockPlan = ({ id, exp, access_model, access, metadata }: Plan): Plan => ({
const createMockPlan = ({ id, original_id, exp, metadata }: Plan): Plan => ({
id,
original_id,
exp,
access_model,
access,
metadata,
metadata: {
name: metadata.name || '',
access: {
drm_policy_id: metadata.access.drm_policy_id,
include_tags: metadata.access.include_tags || [],
exclude_tags: metadata.access.exclude_tags || [],
include_custom_params: metadata.access.include_custom_params || [],
exclude_custom_params: metadata.access.exclude_custom_params || [],
},
access_model: metadata.access_model,
external_providers: metadata.external_providers || {},
},
});

export const PLANS = {
VALID: [
createMockPlan({
id: 'plan1234',
original_id: 123456,
exp: FUTURE_EXPIRY,
access_model: 'svod',
access: {
drm_policy_id: 'drm_policy_123',
},
metadata: {
name: 'Test plan',
access: {
drm_policy_id: 'drm_policy_123',
include_tags: [],
exclude_tags: [],
include_custom_params: [],
exclude_custom_params: [],
},
access_model: 'svod',
external_providers: {
stripe: 'stripe_id',
},
Expand All @@ -71,38 +87,56 @@ export const PLANS = {
FREE: [
createMockPlan({
id: 'free1234',
original_id: 123457,
exp: FUTURE_EXPIRY,
access_model: 'free',
access: {
drm_policy_id: 'drm_policy_456',
},
metadata: {
name: 'Free plan',
access: {
drm_policy_id: 'drm_policy_456',
include_tags: [],
exclude_tags: [],
include_custom_params: [],
exclude_custom_params: [],
},
access_model: 'free',
external_providers: {},
},
}),
],
INVALID: [
createMockPlan({
id: 'plan123456',
original_id: 123458,
exp: FUTURE_EXPIRY,
access_model: 'svod',
access: {
drm_policy_id: 'drm_policy_789',
},
metadata: {
name: 'Invalid plan',
access: {
drm_policy_id: 'drm_policy_789',
include_tags: [],
exclude_tags: [],
include_custom_params: [],
exclude_custom_params: [],
},
access_model: 'svod',
external_providers: {},
},
}),
],
EXPIRED: [
createMockPlan({
id: 'plan1234',
original_id: 123459,
exp: PAST_EXPIRY,
access_model: 'svod',
access: {
drm_policy_id: 'drm_policy_101',
},
metadata: {
name: 'Expired plan',
access: {
drm_policy_id: 'drm_policy_101',
include_tags: [],
exclude_tags: [],
include_custom_params: [],
exclude_custom_params: [],
},
access_model: 'svod',
external_providers: {},
},
}),
Expand Down

0 comments on commit b048b40

Please sign in to comment.