Merge pull request #31678 from overleaf/rh-cio-subscription-status

Sync subscription type and features to customer.io

GitOrigin-RevId: 4c23a6b4ec9f103e73b26203b0d43f177e56bb6e
This commit is contained in:
roo hutton
2026-02-24 09:06:22 +00:00
committed by Copybot
parent f9ad6cf5d1
commit 8fb5b0ed05
2 changed files with 56 additions and 0 deletions
@@ -113,6 +113,13 @@ describe('FeaturesUpdater', function () {
ctx.Modules = {
promises: { hooks: { fire: sinon.stub().resolves() } },
}
ctx.SubscriptionViewModelBuilder = {
promises: {
getUsersSubscriptionDetails: sinon.stub().resolves({
bestSubscription: { type: 'individual' },
}),
},
}
ctx.Queues = {
getQueue: sinon.stub().returns({
add: sinon.stub().resolves(),
@@ -170,6 +177,13 @@ describe('FeaturesUpdater', function () {
default: ctx.Modules,
}))
vi.doMock(
'../../../../app/src/Features/Subscription/SubscriptionViewModelBuilder',
() => ({
default: ctx.SubscriptionViewModelBuilder,
})
)
vi.doMock('../../../../app/src/infrastructure/Queues', () => ({
default: ctx.Queues,
}))
@@ -374,6 +388,17 @@ describe('FeaturesUpdater', function () {
ctx.AnalyticsManager.setUserPropertyForUserInBackground
).to.have.been.calledWith(ctx.user._id, 'feature-set', 'all')
})
it('should sync features to customer.io', function (ctx) {
expect(ctx.Modules.promises.hooks.fire).to.have.been.calledWith(
'setUserProperties',
ctx.user._id,
{
features: ctx.Settings.features.all,
'best-subscription-type': 'individual',
}
)
})
})
describe('with a non-standard feature set', async function () {