Merge pull request #21841 from overleaf/ii-flexible-group-licensing-add-seats
[web] Add seats to a group plan GitOrigin-RevId: 53497d2cb7aa7d1e7dc8291e391b24f7a32eeece
This commit is contained in:
@@ -192,6 +192,39 @@ describe('RecurlyEntities', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('getRequestForAddOnUpdate()', function () {
|
||||
it('returns a change request', function () {
|
||||
const {
|
||||
RecurlySubscriptionChangeRequest,
|
||||
RecurlySubscriptionAddOnUpdate,
|
||||
} = this.RecurlyEntities
|
||||
const newQuantity = 2
|
||||
const changeRequest = this.subscription.getRequestForAddOnUpdate(
|
||||
'add-on-code',
|
||||
newQuantity
|
||||
)
|
||||
expect(changeRequest).to.deep.equal(
|
||||
new RecurlySubscriptionChangeRequest({
|
||||
subscription: this.subscription,
|
||||
timeframe: 'now',
|
||||
addOnUpdates: [
|
||||
new RecurlySubscriptionAddOnUpdate({
|
||||
code: this.addOn.code,
|
||||
quantity: newQuantity,
|
||||
unitPrice: this.addOn.unitPrice,
|
||||
}),
|
||||
],
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("throws a AddOnNotPresentError if the subscription doesn't have the add-on", function () {
|
||||
expect(() =>
|
||||
this.subscription.getRequestForAddOnUpdate('another-add-on', 2)
|
||||
).to.throw(Errors.AddOnNotPresentError)
|
||||
})
|
||||
})
|
||||
|
||||
describe('getRequestForAddOnRemoval()', function () {
|
||||
it('returns a change request', function () {
|
||||
const changeRequest = this.subscription.getRequestForAddOnRemoval(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import esmock from 'esmock'
|
||||
import sinon from 'sinon'
|
||||
import { expect } from 'chai'
|
||||
|
||||
const modulePath =
|
||||
'../../../../app/src/Features/Subscription/SubscriptionGroupController'
|
||||
|
||||
@@ -26,6 +26,7 @@ describe('SubscriptionGroupController', function () {
|
||||
this.subscription = {
|
||||
_id: this.subscriptionId,
|
||||
teamName: 'Cool group',
|
||||
groupPlan: true,
|
||||
}
|
||||
|
||||
this.SubscriptionGroupHandler = {
|
||||
@@ -37,7 +38,6 @@ describe('SubscriptionGroupController', function () {
|
||||
this.SubscriptionLocator = {
|
||||
promises: {
|
||||
getSubscription: sinon.stub().resolves(this.subscription),
|
||||
getUsersSubscription: sinon.stub().resolves(this.subscription),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -71,6 +71,12 @@ describe('SubscriptionGroupController', function () {
|
||||
getAssignment: sinon.stub().yields(null, { variant: 'default' }),
|
||||
}
|
||||
|
||||
this.UserGetter = {
|
||||
promises: {
|
||||
getUserEmail: sinon.stub().resolves(this.user),
|
||||
},
|
||||
}
|
||||
|
||||
this.Controller = await esmock.strict(modulePath, {
|
||||
'../../../../app/src/Features/Subscription/SubscriptionGroupHandler':
|
||||
this.SubscriptionGroupHandler,
|
||||
@@ -83,6 +89,7 @@ describe('SubscriptionGroupController', function () {
|
||||
'../../../../app/src/infrastructure/Modules': this.Modules,
|
||||
'../../../../app/src/Features/SplitTests/SplitTestHandler':
|
||||
this.SplitTestHandler,
|
||||
'../../../../app/src/Features/User/UserGetter': this.UserGetter,
|
||||
'../../../../app/src/Features/Errors/ErrorController':
|
||||
(this.ErrorController = {
|
||||
notFound: sinon.stub(),
|
||||
@@ -269,19 +276,4 @@ describe('SubscriptionGroupController', function () {
|
||||
this.Controller.removeSelfFromGroup(this.req, res, done)
|
||||
})
|
||||
})
|
||||
|
||||
describe('add seats', function () {
|
||||
it('render the request confirmation view', async function () {
|
||||
this.SplitTestHandler.promises.getAssignment.resolves({
|
||||
variant: 'enabled',
|
||||
})
|
||||
await this.Controller.requestConfirmation(this.req, {
|
||||
render: (viewPath, viewParams) => {
|
||||
expect(viewPath).to.equal('subscriptions/request-confirmation-react')
|
||||
expect(viewParams.groupName).to.equal('Cool group')
|
||||
},
|
||||
})
|
||||
expect(this.ErrorController.notFound).to.not.have.been.called
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -27,6 +27,10 @@ describe('SubscriptionGroupHandler', function () {
|
||||
},
|
||||
}
|
||||
|
||||
this.SubscriptionController = {
|
||||
makeChangePreview: sinon.stub().resolves(),
|
||||
}
|
||||
|
||||
this.SubscriptionUpdater = {
|
||||
promises: {
|
||||
removeUserFromGroup: sinon.stub().resolves(),
|
||||
@@ -40,13 +44,19 @@ describe('SubscriptionGroupHandler', function () {
|
||||
findOne: sinon.stub().returns({ exec: sinon.stub().resolves }),
|
||||
}
|
||||
|
||||
this.RecurlyClient = {
|
||||
promises: {},
|
||||
}
|
||||
|
||||
this.Handler = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'./SubscriptionUpdater': this.SubscriptionUpdater,
|
||||
'./SubscriptionLocator': this.SubscriptionLocator,
|
||||
'./SubscriptionController': this.SubscriptionController,
|
||||
'../../models/Subscription': {
|
||||
Subscription: this.Subscription,
|
||||
},
|
||||
'./RecurlyClient': this.RecurlyClient,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user