|
@@ -1,17 +1,3 @@
|
|
|
-/* eslint-disable
|
|
|
|
|
- camelcase,
|
|
|
|
|
- node/handle-callback-err,
|
|
|
|
|
- max-len,
|
|
|
|
|
- no-return-assign,
|
|
|
|
|
- no-unused-vars,
|
|
|
|
|
-*/
|
|
|
|
|
-// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
|
-// Fix any style issues and re-enable lint.
|
|
|
|
|
-/*
|
|
|
|
|
- * decaffeinate suggestions:
|
|
|
|
|
- * DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
|
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
|
- */
|
|
|
|
|
const SandboxedModule = require('sandboxed-module')
|
|
const SandboxedModule = require('sandboxed-module')
|
|
|
const sinon = require('sinon')
|
|
const sinon = require('sinon')
|
|
|
const modulePath = require('path').join(
|
|
const modulePath = require('path').join(
|
|
@@ -21,23 +7,23 @@ const modulePath = require('path').join(
|
|
|
|
|
|
|
|
describe('LimitationsManager', function () {
|
|
describe('LimitationsManager', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
- this.project = { _id: (this.project_id = 'project-id') }
|
|
|
|
|
- this.user = { _id: (this.user_id = 'user-id'), features: {} }
|
|
|
|
|
|
|
+ this.project = { _id: (this.projectId = 'project-id') }
|
|
|
|
|
+ this.user = { _id: (this.userId = 'user-id'), features: {} }
|
|
|
this.ProjectGetter = {
|
|
this.ProjectGetter = {
|
|
|
- getProject: (project_id, fields, callback) => {
|
|
|
|
|
- if (project_id === this.project_id) {
|
|
|
|
|
- return callback(null, this.project)
|
|
|
|
|
|
|
+ getProject: (projectId, fields, callback) => {
|
|
|
|
|
+ if (projectId === this.projectId) {
|
|
|
|
|
+ callback(null, this.project)
|
|
|
} else {
|
|
} else {
|
|
|
- return callback(null, null)
|
|
|
|
|
|
|
+ callback(null, null)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
this.UserGetter = {
|
|
this.UserGetter = {
|
|
|
- getUser: (user_id, filter, callback) => {
|
|
|
|
|
- if (user_id === this.user_id) {
|
|
|
|
|
- return callback(null, this.user)
|
|
|
|
|
|
|
+ getUser: (userId, filter, callback) => {
|
|
|
|
|
+ if (userId === this.userId) {
|
|
|
|
|
+ callback(null, this.user)
|
|
|
} else {
|
|
} else {
|
|
|
- return callback(null, null)
|
|
|
|
|
|
|
+ callback(null, null)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
@@ -47,7 +33,7 @@ describe('LimitationsManager', function () {
|
|
|
getSubscription: sinon.stub(),
|
|
getSubscription: sinon.stub(),
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return (this.LimitationsManager = SandboxedModule.require(modulePath, {
|
|
|
|
|
|
|
+ this.LimitationsManager = SandboxedModule.require(modulePath, {
|
|
|
requires: {
|
|
requires: {
|
|
|
'../Project/ProjectGetter': this.ProjectGetter,
|
|
'../Project/ProjectGetter': this.ProjectGetter,
|
|
|
'../User/UserGetter': this.UserGetter,
|
|
'../User/UserGetter': this.UserGetter,
|
|
@@ -57,24 +43,24 @@ describe('LimitationsManager', function () {
|
|
|
'../Collaborators/CollaboratorsInviteHandler': (this.CollaboratorsInviteHandler = {}),
|
|
'../Collaborators/CollaboratorsInviteHandler': (this.CollaboratorsInviteHandler = {}),
|
|
|
'./V1SubscriptionManager': (this.V1SubscriptionManager = {}),
|
|
'./V1SubscriptionManager': (this.V1SubscriptionManager = {}),
|
|
|
},
|
|
},
|
|
|
- }))
|
|
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('allowedNumberOfCollaboratorsInProject', function () {
|
|
describe('allowedNumberOfCollaboratorsInProject', function () {
|
|
|
describe('when the project is owned by a user without a subscription', function () {
|
|
describe('when the project is owned by a user without a subscription', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
this.Settings.defaultFeatures = { collaborators: 23 }
|
|
this.Settings.defaultFeatures = { collaborators: 23 }
|
|
|
- this.project.owner_ref = this.user_id
|
|
|
|
|
|
|
+ this.project.owner_ref = this.userId
|
|
|
delete this.user.features
|
|
delete this.user.features
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.allowedNumberOfCollaboratorsInProject(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.allowedNumberOfCollaboratorsInProject(
|
|
|
|
|
+ this.projectId,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return the default number', function () {
|
|
it('should return the default number', function () {
|
|
|
- return this.callback
|
|
|
|
|
|
|
+ this.callback
|
|
|
.calledWith(null, this.Settings.defaultFeatures.collaborators)
|
|
.calledWith(null, this.Settings.defaultFeatures.collaborators)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
})
|
|
})
|
|
@@ -82,17 +68,17 @@ describe('LimitationsManager', function () {
|
|
|
|
|
|
|
|
describe('when the project is owned by a user with a subscription', function () {
|
|
describe('when the project is owned by a user with a subscription', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
- this.project.owner_ref = this.user_id
|
|
|
|
|
|
|
+ this.project.owner_ref = this.userId
|
|
|
this.user.features = { collaborators: 21 }
|
|
this.user.features = { collaborators: 21 }
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.allowedNumberOfCollaboratorsInProject(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.allowedNumberOfCollaboratorsInProject(
|
|
|
|
|
+ this.projectId,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return the number of collaborators the user is allowed', function () {
|
|
it('should return the number of collaborators the user is allowed', function () {
|
|
|
- return this.callback
|
|
|
|
|
|
|
+ this.callback
|
|
|
.calledWith(null, this.user.features.collaborators)
|
|
.calledWith(null, this.user.features.collaborators)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
})
|
|
})
|
|
@@ -105,14 +91,14 @@ describe('LimitationsManager', function () {
|
|
|
this.Settings.defaultFeatures = { collaborators: 23 }
|
|
this.Settings.defaultFeatures = { collaborators: 23 }
|
|
|
delete this.user.features
|
|
delete this.user.features
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.allowedNumberOfCollaboratorsForUser(
|
|
|
|
|
- this.user_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.allowedNumberOfCollaboratorsForUser(
|
|
|
|
|
+ this.userId,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return the default number', function () {
|
|
it('should return the default number', function () {
|
|
|
- return this.callback
|
|
|
|
|
|
|
+ this.callback
|
|
|
.calledWith(null, this.Settings.defaultFeatures.collaborators)
|
|
.calledWith(null, this.Settings.defaultFeatures.collaborators)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
})
|
|
})
|
|
@@ -122,14 +108,14 @@ describe('LimitationsManager', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
this.user.features = { collaborators: 21 }
|
|
this.user.features = { collaborators: 21 }
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.allowedNumberOfCollaboratorsForUser(
|
|
|
|
|
- this.user_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.allowedNumberOfCollaboratorsForUser(
|
|
|
|
|
+ this.userId,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return the number of collaborators the user is allowed', function () {
|
|
it('should return the number of collaborators the user is allowed', function () {
|
|
|
- return this.callback
|
|
|
|
|
|
|
+ this.callback
|
|
|
.calledWith(null, this.user.features.collaborators)
|
|
.calledWith(null, this.user.features.collaborators)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
})
|
|
})
|
|
@@ -143,11 +129,11 @@ describe('LimitationsManager', function () {
|
|
|
this.allowed_number = 2
|
|
this.allowed_number = 2
|
|
|
this.invite_count = 0
|
|
this.invite_count = 0
|
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.current_number)
|
|
) => callback(null, this.current_number)
|
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.invite_count)
|
|
) => callback(null, this.invite_count)
|
|
|
sinon
|
|
sinon
|
|
@@ -155,19 +141,19 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager,
|
|
this.LimitationsManager,
|
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
|
)
|
|
)
|
|
|
- .callsFake((project_id, callback) => {
|
|
|
|
|
- return callback(null, this.allowed_number)
|
|
|
|
|
|
|
+ .callsFake((projectId, callback) => {
|
|
|
|
|
+ callback(null, this.allowed_number)
|
|
|
})
|
|
})
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
+ this.projectId,
|
|
|
1,
|
|
1,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return true', function () {
|
|
it('should return true', function () {
|
|
|
- return this.callback.calledWith(null, true).should.equal(true)
|
|
|
|
|
|
|
+ this.callback.calledWith(null, true).should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -177,11 +163,11 @@ describe('LimitationsManager', function () {
|
|
|
this.allowed_number = 4
|
|
this.allowed_number = 4
|
|
|
this.invite_count = 1
|
|
this.invite_count = 1
|
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.current_number)
|
|
) => callback(null, this.current_number)
|
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.invite_count)
|
|
) => callback(null, this.invite_count)
|
|
|
sinon
|
|
sinon
|
|
@@ -189,19 +175,19 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager,
|
|
this.LimitationsManager,
|
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
|
)
|
|
)
|
|
|
- .callsFake((project_id, callback) => {
|
|
|
|
|
- return callback(null, this.allowed_number)
|
|
|
|
|
|
|
+ .callsFake((projectId, callback) => {
|
|
|
|
|
+ callback(null, this.allowed_number)
|
|
|
})
|
|
})
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
+ this.projectId,
|
|
|
1,
|
|
1,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return true', function () {
|
|
it('should return true', function () {
|
|
|
- return this.callback.calledWith(null, true).should.equal(true)
|
|
|
|
|
|
|
+ this.callback.calledWith(null, true).should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -211,11 +197,11 @@ describe('LimitationsManager', function () {
|
|
|
this.allowed_number = 2
|
|
this.allowed_number = 2
|
|
|
this.invite_count = 0
|
|
this.invite_count = 0
|
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.current_number)
|
|
) => callback(null, this.current_number)
|
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.invite_count)
|
|
) => callback(null, this.invite_count)
|
|
|
sinon
|
|
sinon
|
|
@@ -223,19 +209,19 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager,
|
|
this.LimitationsManager,
|
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
|
)
|
|
)
|
|
|
- .callsFake((project_id, callback) => {
|
|
|
|
|
- return callback(null, this.allowed_number)
|
|
|
|
|
|
|
+ .callsFake((projectId, callback) => {
|
|
|
|
|
+ callback(null, this.allowed_number)
|
|
|
})
|
|
})
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
+ this.projectId,
|
|
|
2,
|
|
2,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return false', function () {
|
|
it('should return false', function () {
|
|
|
- return this.callback.calledWith(null, false).should.equal(true)
|
|
|
|
|
|
|
+ this.callback.calledWith(null, false).should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -245,11 +231,11 @@ describe('LimitationsManager', function () {
|
|
|
this.allowed_number = 2
|
|
this.allowed_number = 2
|
|
|
this.invite_count = 0
|
|
this.invite_count = 0
|
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.current_number)
|
|
) => callback(null, this.current_number)
|
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.invite_count)
|
|
) => callback(null, this.invite_count)
|
|
|
sinon
|
|
sinon
|
|
@@ -257,19 +243,19 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager,
|
|
this.LimitationsManager,
|
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
|
)
|
|
)
|
|
|
- .callsFake((project_id, callback) => {
|
|
|
|
|
- return callback(null, this.allowed_number)
|
|
|
|
|
|
|
+ .callsFake((projectId, callback) => {
|
|
|
|
|
+ callback(null, this.allowed_number)
|
|
|
})
|
|
})
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
+ this.projectId,
|
|
|
1,
|
|
1,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return false', function () {
|
|
it('should return false', function () {
|
|
|
- return this.callback.calledWith(null, false).should.equal(true)
|
|
|
|
|
|
|
+ this.callback.calledWith(null, false).should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -279,11 +265,11 @@ describe('LimitationsManager', function () {
|
|
|
this.allowed_number = -1
|
|
this.allowed_number = -1
|
|
|
this.invite_count = 0
|
|
this.invite_count = 0
|
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.current_number)
|
|
) => callback(null, this.current_number)
|
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.invite_count)
|
|
) => callback(null, this.invite_count)
|
|
|
sinon
|
|
sinon
|
|
@@ -291,19 +277,19 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager,
|
|
this.LimitationsManager,
|
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
|
)
|
|
)
|
|
|
- .callsFake((project_id, callback) => {
|
|
|
|
|
- return callback(null, this.allowed_number)
|
|
|
|
|
|
|
+ .callsFake((projectId, callback) => {
|
|
|
|
|
+ callback(null, this.allowed_number)
|
|
|
})
|
|
})
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
+ this.projectId,
|
|
|
1,
|
|
1,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return true', function () {
|
|
it('should return true', function () {
|
|
|
- return this.callback.calledWith(null, true).should.equal(true)
|
|
|
|
|
|
|
+ this.callback.calledWith(null, true).should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -313,11 +299,11 @@ describe('LimitationsManager', function () {
|
|
|
this.allowed_number = 2
|
|
this.allowed_number = 2
|
|
|
this.invite_count = 2
|
|
this.invite_count = 2
|
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.current_number)
|
|
) => callback(null, this.current_number)
|
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.invite_count)
|
|
) => callback(null, this.invite_count)
|
|
|
sinon
|
|
sinon
|
|
@@ -325,19 +311,19 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager,
|
|
this.LimitationsManager,
|
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
|
)
|
|
)
|
|
|
- .callsFake((project_id, callback) => {
|
|
|
|
|
- return callback(null, this.allowed_number)
|
|
|
|
|
|
|
+ .callsFake((projectId, callback) => {
|
|
|
|
|
+ callback(null, this.allowed_number)
|
|
|
})
|
|
})
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
+ this.projectId,
|
|
|
1,
|
|
1,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return false', function () {
|
|
it('should return false', function () {
|
|
|
- return this.callback.calledWith(null, false).should.equal(true)
|
|
|
|
|
|
|
+ this.callback.calledWith(null, false).should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -347,11 +333,11 @@ describe('LimitationsManager', function () {
|
|
|
this.allowed_number = 2
|
|
this.allowed_number = 2
|
|
|
this.invite_count = 1
|
|
this.invite_count = 1
|
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
this.CollaboratorsGetter.getInvitedCollaboratorCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.current_number)
|
|
) => callback(null, this.current_number)
|
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
this.CollaboratorsInviteHandler.getInviteCount = (
|
|
|
- project_id,
|
|
|
|
|
|
|
+ projectId,
|
|
|
callback
|
|
callback
|
|
|
) => callback(null, this.invite_count)
|
|
) => callback(null, this.invite_count)
|
|
|
sinon
|
|
sinon
|
|
@@ -359,37 +345,37 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager,
|
|
this.LimitationsManager,
|
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
'allowedNumberOfCollaboratorsInProject'
|
|
|
)
|
|
)
|
|
|
- .callsFake((project_id, callback) => {
|
|
|
|
|
- return callback(null, this.allowed_number)
|
|
|
|
|
|
|
+ .callsFake((projectId, callback) => {
|
|
|
|
|
+ callback(null, this.allowed_number)
|
|
|
})
|
|
})
|
|
|
this.callback = sinon.stub()
|
|
this.callback = sinon.stub()
|
|
|
- return this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
- this.project_id,
|
|
|
|
|
|
|
+ this.LimitationsManager.canAddXCollaborators(
|
|
|
|
|
+ this.projectId,
|
|
|
1,
|
|
1,
|
|
|
this.callback
|
|
this.callback
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return false', function () {
|
|
it('should return false', function () {
|
|
|
- return this.callback.calledWith(null, false).should.equal(true)
|
|
|
|
|
|
|
+ this.callback.calledWith(null, false).should.equal(true)
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('userHasV2Subscription', function () {
|
|
describe('userHasV2Subscription', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
- return (this.SubscriptionLocator.getUsersSubscription = sinon.stub())
|
|
|
|
|
|
|
+ this.SubscriptionLocator.getUsersSubscription = sinon.stub()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return true if the recurly token is set', function (done) {
|
|
it('should return true if the recurly token is set', function (done) {
|
|
|
this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {
|
|
this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {
|
|
|
recurlySubscription_id: '1234',
|
|
recurlySubscription_id: '1234',
|
|
|
})
|
|
})
|
|
|
- return this.LimitationsManager.userHasV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubscription) => {
|
|
(err, hasSubscription) => {
|
|
|
hasSubscription.should.equal(true)
|
|
hasSubscription.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -397,22 +383,22 @@ describe('LimitationsManager', function () {
|
|
|
it('should return false if the recurly token is not set', function (done) {
|
|
it('should return false if the recurly token is not set', function (done) {
|
|
|
this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
|
|
this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
|
|
|
this.subscription = {}
|
|
this.subscription = {}
|
|
|
- return this.LimitationsManager.userHasV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubscription) => {
|
|
(err, hasSubscription) => {
|
|
|
hasSubscription.should.equal(false)
|
|
hasSubscription.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return false if the subscription is undefined', function (done) {
|
|
it('should return false if the subscription is undefined', function (done) {
|
|
|
this.SubscriptionLocator.getUsersSubscription.callsArgWith(1)
|
|
this.SubscriptionLocator.getUsersSubscription.callsArgWith(1)
|
|
|
- return this.LimitationsManager.userHasV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubscription) => {
|
|
(err, hasSubscription) => {
|
|
|
hasSubscription.should.equal(false)
|
|
hasSubscription.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -424,11 +410,11 @@ describe('LimitationsManager', function () {
|
|
|
null,
|
|
null,
|
|
|
stubbedSubscription
|
|
stubbedSubscription
|
|
|
)
|
|
)
|
|
|
- return this.LimitationsManager.userHasV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubOrIsGroupMember, subscription) => {
|
|
(err, hasSubOrIsGroupMember, subscription) => {
|
|
|
subscription.should.deep.equal(stubbedSubscription)
|
|
subscription.should.deep.equal(stubbedSubscription)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -436,7 +422,7 @@ describe('LimitationsManager', function () {
|
|
|
describe('when user has a custom account', function () {
|
|
describe('when user has a custom account', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
this.fakeSubscription = { customAccount: true }
|
|
this.fakeSubscription = { customAccount: true }
|
|
|
- return this.SubscriptionLocator.getUsersSubscription.callsArgWith(
|
|
|
|
|
|
|
+ this.SubscriptionLocator.getUsersSubscription.callsArgWith(
|
|
|
1,
|
|
1,
|
|
|
null,
|
|
null,
|
|
|
this.fakeSubscription
|
|
this.fakeSubscription
|
|
@@ -444,21 +430,21 @@ describe('LimitationsManager', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return true', function (done) {
|
|
it('should return true', function (done) {
|
|
|
- return this.LimitationsManager.userHasV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubscription, subscription) => {
|
|
(err, hasSubscription, subscription) => {
|
|
|
hasSubscription.should.equal(true)
|
|
hasSubscription.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return the subscription', function (done) {
|
|
it('should return the subscription', function (done) {
|
|
|
- return this.LimitationsManager.userHasV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubscription, subscription) => {
|
|
(err, hasSubscription, subscription) => {
|
|
|
subscription.should.deep.equal(this.fakeSubscription)
|
|
subscription.should.deep.equal(this.fakeSubscription)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -467,16 +453,16 @@ describe('LimitationsManager', function () {
|
|
|
|
|
|
|
|
describe('userIsMemberOfGroupSubscription', function () {
|
|
describe('userIsMemberOfGroupSubscription', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
- return (this.SubscriptionLocator.getMemberSubscriptions = sinon.stub())
|
|
|
|
|
|
|
+ this.SubscriptionLocator.getMemberSubscriptions = sinon.stub()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return false if there are no groups subcriptions', function (done) {
|
|
it('should return false if there are no groups subcriptions', function (done) {
|
|
|
this.SubscriptionLocator.getMemberSubscriptions.callsArgWith(1, null, [])
|
|
this.SubscriptionLocator.getMemberSubscriptions.callsArgWith(1, null, [])
|
|
|
- return this.LimitationsManager.userIsMemberOfGroupSubscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userIsMemberOfGroupSubscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, isMember) => {
|
|
(err, isMember) => {
|
|
|
isMember.should.equal(false)
|
|
isMember.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -488,12 +474,12 @@ describe('LimitationsManager', function () {
|
|
|
null,
|
|
null,
|
|
|
(subscriptions = ['mock-subscription'])
|
|
(subscriptions = ['mock-subscription'])
|
|
|
)
|
|
)
|
|
|
- return this.LimitationsManager.userIsMemberOfGroupSubscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userIsMemberOfGroupSubscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, isMember, retSubscriptions) => {
|
|
(err, isMember, retSubscriptions) => {
|
|
|
isMember.should.equal(true)
|
|
isMember.should.equal(true)
|
|
|
retSubscriptions.should.equal(subscriptions)
|
|
retSubscriptions.should.equal(subscriptions)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -507,20 +493,20 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager.userHasV2Subscription = sinon
|
|
this.LimitationsManager.userHasV2Subscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, false)
|
|
.yields(null, false)
|
|
|
- return (this.LimitationsManager.userHasV1Subscription = sinon
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV1Subscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
- .yields(null, false))
|
|
|
|
|
|
|
+ .yields(null, false)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return true if userIsMemberOfGroupSubscription', function (done) {
|
|
it('should return true if userIsMemberOfGroupSubscription', function (done) {
|
|
|
this.LimitationsManager.userIsMemberOfGroupSubscription = sinon
|
|
this.LimitationsManager.userIsMemberOfGroupSubscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, true)
|
|
.yields(null, true)
|
|
|
- return this.LimitationsManager.hasPaidSubscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.hasPaidSubscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubOrIsGroupMember) => {
|
|
(err, hasSubOrIsGroupMember) => {
|
|
|
hasSubOrIsGroupMember.should.equal(true)
|
|
hasSubOrIsGroupMember.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -529,11 +515,11 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager.userHasV2Subscription = sinon
|
|
this.LimitationsManager.userHasV2Subscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, true)
|
|
.yields(null, true)
|
|
|
- return this.LimitationsManager.hasPaidSubscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.hasPaidSubscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubOrIsGroupMember) => {
|
|
(err, hasSubOrIsGroupMember) => {
|
|
|
hasSubOrIsGroupMember.should.equal(true)
|
|
hasSubOrIsGroupMember.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -542,31 +528,31 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager.userHasV1Subscription = sinon
|
|
this.LimitationsManager.userHasV1Subscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, true)
|
|
.yields(null, true)
|
|
|
- return this.LimitationsManager.hasPaidSubscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.hasPaidSubscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubOrIsGroupMember) => {
|
|
(err, hasSubOrIsGroupMember) => {
|
|
|
hasSubOrIsGroupMember.should.equal(true)
|
|
hasSubOrIsGroupMember.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return false if none are true', function (done) {
|
|
it('should return false if none are true', function (done) {
|
|
|
- return this.LimitationsManager.hasPaidSubscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.hasPaidSubscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubOrIsGroupMember) => {
|
|
(err, hasSubOrIsGroupMember) => {
|
|
|
hasSubOrIsGroupMember.should.equal(false)
|
|
hasSubOrIsGroupMember.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should have userHasSubscriptionOrIsGroupMember alias', function (done) {
|
|
it('should have userHasSubscriptionOrIsGroupMember alias', function (done) {
|
|
|
- return this.LimitationsManager.userHasSubscriptionOrIsGroupMember(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasSubscriptionOrIsGroupMember(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSubOrIsGroupMember) => {
|
|
(err, hasSubOrIsGroupMember) => {
|
|
|
hasSubOrIsGroupMember.should.equal(false)
|
|
hasSubOrIsGroupMember.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -577,20 +563,20 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager.userHasV2Subscription = sinon
|
|
this.LimitationsManager.userHasV2Subscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, false)
|
|
.yields(null, false)
|
|
|
- return (this.LimitationsManager.userHasV1Subscription = sinon
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV1Subscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
- .yields(null, false))
|
|
|
|
|
|
|
+ .yields(null, false)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return true if userHasV2Subscription', function (done) {
|
|
it('should return true if userHasV2Subscription', function (done) {
|
|
|
this.LimitationsManager.userHasV2Subscription = sinon
|
|
this.LimitationsManager.userHasV2Subscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, true)
|
|
.yields(null, true)
|
|
|
- return this.LimitationsManager.userHasV1OrV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV1OrV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSub) => {
|
|
(err, hasSub) => {
|
|
|
hasSub.should.equal(true)
|
|
hasSub.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -599,21 +585,21 @@ describe('LimitationsManager', function () {
|
|
|
this.LimitationsManager.userHasV1Subscription = sinon
|
|
this.LimitationsManager.userHasV1Subscription = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, true)
|
|
.yields(null, true)
|
|
|
- return this.LimitationsManager.userHasV1OrV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV1OrV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSub) => {
|
|
(err, hasSub) => {
|
|
|
hasSub.should.equal(true)
|
|
hasSub.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return false if none are true', function (done) {
|
|
it('should return false if none are true', function (done) {
|
|
|
- return this.LimitationsManager.userHasV1OrV2Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV1OrV2Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(err, hasSub) => {
|
|
(err, hasSub) => {
|
|
|
hasSub.should.equal(false)
|
|
hasSub.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -622,13 +608,13 @@ describe('LimitationsManager', function () {
|
|
|
describe('hasGroupMembersLimitReached', function () {
|
|
describe('hasGroupMembersLimitReached', function () {
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
|
this.subscriptionId = '12312'
|
|
this.subscriptionId = '12312'
|
|
|
- return (this.subscription = {
|
|
|
|
|
|
|
+ this.subscription = {
|
|
|
membersLimit: 3,
|
|
membersLimit: 3,
|
|
|
member_ids: ['', ''],
|
|
member_ids: ['', ''],
|
|
|
teamInvites: [
|
|
teamInvites: [
|
|
|
{ email: 'bob@example.com', sentAt: new Date(), token: 'hey' },
|
|
{ email: 'bob@example.com', sentAt: new Date(), token: 'hey' },
|
|
|
],
|
|
],
|
|
|
- })
|
|
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should return true if the limit is hit (including members and invites)', function (done) {
|
|
it('should return true if the limit is hit (including members and invites)', function (done) {
|
|
@@ -637,11 +623,11 @@ describe('LimitationsManager', function () {
|
|
|
null,
|
|
null,
|
|
|
this.subscription
|
|
this.subscription
|
|
|
)
|
|
)
|
|
|
- return this.LimitationsManager.hasGroupMembersLimitReached(
|
|
|
|
|
|
|
+ this.LimitationsManager.hasGroupMembersLimitReached(
|
|
|
this.subscriptionId,
|
|
this.subscriptionId,
|
|
|
(err, limitReached) => {
|
|
(err, limitReached) => {
|
|
|
limitReached.should.equal(true)
|
|
limitReached.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -653,11 +639,11 @@ describe('LimitationsManager', function () {
|
|
|
null,
|
|
null,
|
|
|
this.subscription
|
|
this.subscription
|
|
|
)
|
|
)
|
|
|
- return this.LimitationsManager.hasGroupMembersLimitReached(
|
|
|
|
|
|
|
+ this.LimitationsManager.hasGroupMembersLimitReached(
|
|
|
this.subscriptionId,
|
|
this.subscriptionId,
|
|
|
(err, limitReached) => {
|
|
(err, limitReached) => {
|
|
|
limitReached.should.equal(false)
|
|
limitReached.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -669,11 +655,11 @@ describe('LimitationsManager', function () {
|
|
|
null,
|
|
null,
|
|
|
this.subscription
|
|
this.subscription
|
|
|
)
|
|
)
|
|
|
- return this.LimitationsManager.hasGroupMembersLimitReached(
|
|
|
|
|
|
|
+ this.LimitationsManager.hasGroupMembersLimitReached(
|
|
|
this.subscriptionId,
|
|
this.subscriptionId,
|
|
|
(err, limitReached) => {
|
|
(err, limitReached) => {
|
|
|
limitReached.should.equal(true)
|
|
limitReached.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -684,14 +670,14 @@ describe('LimitationsManager', function () {
|
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, { has_subscription: true })
|
|
.yields(null, { has_subscription: true })
|
|
|
- return this.LimitationsManager.userHasV1Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV1Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(error, result) => {
|
|
(error, result) => {
|
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1
|
|
|
- .calledWith(this.user_id)
|
|
|
|
|
|
|
+ .calledWith(this.userId)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
result.should.equal(true)
|
|
result.should.equal(true)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -700,14 +686,14 @@ describe('LimitationsManager', function () {
|
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, { has_subscription: false })
|
|
.yields(null, { has_subscription: false })
|
|
|
- return this.LimitationsManager.userHasV1Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV1Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(error, result) => {
|
|
(error, result) => {
|
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1
|
|
|
- .calledWith(this.user_id)
|
|
|
|
|
|
|
+ .calledWith(this.userId)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
result.should.equal(false)
|
|
result.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
@@ -716,14 +702,14 @@ describe('LimitationsManager', function () {
|
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.yields(null, null)
|
|
.yields(null, null)
|
|
|
- return this.LimitationsManager.userHasV1Subscription(
|
|
|
|
|
|
|
+ this.LimitationsManager.userHasV1Subscription(
|
|
|
this.user,
|
|
this.user,
|
|
|
(error, result) => {
|
|
(error, result) => {
|
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1
|
|
this.V1SubscriptionManager.getSubscriptionsFromV1
|
|
|
- .calledWith(this.user_id)
|
|
|
|
|
|
|
+ .calledWith(this.userId)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
result.should.equal(false)
|
|
result.should.equal(false)
|
|
|
- return done()
|
|
|
|
|
|
|
+ done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|