mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #36496 from overleaf/oa-annual-events
[web] Subscription event segmentation GitOrigin-RevId: fdc25ac7bc7320ed82617b7c27c12a17eb31d723
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
import { expect } from 'chai'
|
||||
import getSubscriptionEventSegmentation from '../../../../../frontend/js/features/subscription/util/subscription-event-segmentation'
|
||||
import {
|
||||
annualActiveSubscriptionEuro,
|
||||
monthlyActiveCollaborator,
|
||||
trialCollaboratorSubscription,
|
||||
} from '../fixtures/subscriptions'
|
||||
|
||||
describe('getSubscriptionEventSegmentation', function () {
|
||||
it('segments a monthly subscription', function () {
|
||||
expect(
|
||||
getSubscriptionEventSegmentation(monthlyActiveCollaborator)
|
||||
).to.deep.equal({
|
||||
plan_code: 'collaborator',
|
||||
billing_cycle: 'monthly',
|
||||
is_trial: false,
|
||||
currency: 'USD',
|
||||
})
|
||||
})
|
||||
|
||||
it('segments an annual subscription', function () {
|
||||
expect(
|
||||
getSubscriptionEventSegmentation(annualActiveSubscriptionEuro)
|
||||
).to.deep.equal({
|
||||
plan_code: 'collaborator-annual',
|
||||
billing_cycle: 'annual',
|
||||
is_trial: false,
|
||||
currency: 'EUR',
|
||||
})
|
||||
})
|
||||
|
||||
it('segments a subscription in a free trial', function () {
|
||||
expect(
|
||||
getSubscriptionEventSegmentation(trialCollaboratorSubscription)
|
||||
).to.deep.equal({
|
||||
plan_code: 'collaborator_free_trial_7_days',
|
||||
billing_cycle: 'monthly',
|
||||
is_trial: true,
|
||||
currency: 'USD',
|
||||
})
|
||||
})
|
||||
|
||||
it('omits the plan segmentation without a subscription', function () {
|
||||
expect(getSubscriptionEventSegmentation(undefined)).to.deep.equal({
|
||||
plan_code: undefined,
|
||||
billing_cycle: undefined,
|
||||
is_trial: false,
|
||||
currency: undefined,
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user