overleaf/services/web/test/frontend/features/subscription/util/can-extend-trial.test.ts
Jessica Lawshe ebc04e4a9d Merge pull request #11888 from overleaf/jel-subscription-dash-cancel-plan
[web] Migrate cancel subscription to React

GitOrigin-RevId: 8482fd61894c8011b4c980263ae1d41f396233c6
2023-02-24 09:05:12 +00:00

24 lines
1.1 KiB
TypeScript

import { expect } from 'chai'
import canExtendTrial from '../../../../../frontend/js/features/subscription/util/can-extend-trial'
describe('canExtendTrial', function () {
const d = new Date()
d.setDate(d.getDate() + 6)
it('returns false when no trial end date', function () {
expect(canExtendTrial('collab')).to.be.false
})
it('returns false when a plan code without "collaborator" ', function () {
expect(canExtendTrial('test', false, d.toString())).to.be.false
})
it('returns false when on a plan with trial date in future but has "collaborator" and "ann" in plan code', function () {
expect(canExtendTrial('collaborator-annual', false, d.toString())).to.be
.false
})
it('returns false when on a plan with trial date in future and plan code has "collaborator" and no "ann" but is a group plan', function () {
expect(canExtendTrial('collaborator', true, d.toString())).to.be.false
})
it('returns true when on a plan with "collaborator" and without "ann" and trial date in future', function () {
expect(canExtendTrial('collaborator', false, d.toString())).to.be.true
})
})