LimitationsManagerTests.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. /* eslint-disable
  2. camelcase,
  3. handle-callback-err,
  4. max-len,
  5. no-return-assign,
  6. no-unused-vars,
  7. */
  8. // TODO: This file was created by bulk-decaffeinate.
  9. // Fix any style issues and re-enable lint.
  10. /*
  11. * decaffeinate suggestions:
  12. * DS102: Remove unnecessary code created because of implicit returns
  13. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  14. */
  15. const SandboxedModule = require('sandboxed-module')
  16. const sinon = require('sinon')
  17. require('chai').should()
  18. const modulePath = require('path').join(
  19. __dirname,
  20. '../../../../app/src/Features/Subscription/LimitationsManager'
  21. )
  22. const Settings = require('settings-sharelatex')
  23. describe('LimitationsManager', function() {
  24. beforeEach(function() {
  25. this.project = { _id: (this.project_id = 'project-id') }
  26. this.user = { _id: (this.user_id = 'user-id'), features: {} }
  27. this.ProjectGetter = {
  28. getProject: (project_id, fields, callback) => {
  29. if (project_id === this.project_id) {
  30. return callback(null, this.project)
  31. } else {
  32. return callback(null, null)
  33. }
  34. }
  35. }
  36. this.UserGetter = {
  37. getUser: (user_id, filter, callback) => {
  38. if (user_id === this.user_id) {
  39. return callback(null, this.user)
  40. } else {
  41. return callback(null, null)
  42. }
  43. }
  44. }
  45. this.SubscriptionLocator = {
  46. getUsersSubscription: sinon.stub(),
  47. getSubscription: sinon.stub()
  48. }
  49. return (this.LimitationsManager = SandboxedModule.require(modulePath, {
  50. globals: {
  51. console: console
  52. },
  53. requires: {
  54. '../Project/ProjectGetter': this.ProjectGetter,
  55. '../User/UserGetter': this.UserGetter,
  56. './SubscriptionLocator': this.SubscriptionLocator,
  57. 'settings-sharelatex': (this.Settings = {}),
  58. '../Collaborators/CollaboratorsGetter': (this.CollaboratorsGetter = {}),
  59. '../Collaborators/CollaboratorsInviteHandler': (this.CollaboratorsInviteHandler = {}),
  60. './V1SubscriptionManager': (this.V1SubscriptionManager = {}),
  61. 'logger-sharelatex': {
  62. log() {}
  63. }
  64. }
  65. }))
  66. })
  67. describe('allowedNumberOfCollaboratorsInProject', function() {
  68. describe('when the project is owned by a user without a subscription', function() {
  69. beforeEach(function() {
  70. this.Settings.defaultFeatures = { collaborators: 23 }
  71. this.project.owner_ref = this.user_id
  72. delete this.user.features
  73. this.callback = sinon.stub()
  74. return this.LimitationsManager.allowedNumberOfCollaboratorsInProject(
  75. this.project_id,
  76. this.callback
  77. )
  78. })
  79. it('should return the default number', function() {
  80. return this.callback
  81. .calledWith(null, this.Settings.defaultFeatures.collaborators)
  82. .should.equal(true)
  83. })
  84. })
  85. describe('when the project is owned by a user with a subscription', function() {
  86. beforeEach(function() {
  87. this.project.owner_ref = this.user_id
  88. this.user.features = { collaborators: 21 }
  89. this.callback = sinon.stub()
  90. return this.LimitationsManager.allowedNumberOfCollaboratorsInProject(
  91. this.project_id,
  92. this.callback
  93. )
  94. })
  95. it('should return the number of collaborators the user is allowed', function() {
  96. return this.callback
  97. .calledWith(null, this.user.features.collaborators)
  98. .should.equal(true)
  99. })
  100. })
  101. })
  102. describe('allowedNumberOfCollaboratorsForUser', function() {
  103. describe('when the user has no features', function() {
  104. beforeEach(function() {
  105. this.Settings.defaultFeatures = { collaborators: 23 }
  106. delete this.user.features
  107. this.callback = sinon.stub()
  108. return this.LimitationsManager.allowedNumberOfCollaboratorsForUser(
  109. this.user_id,
  110. this.callback
  111. )
  112. })
  113. it('should return the default number', function() {
  114. return this.callback
  115. .calledWith(null, this.Settings.defaultFeatures.collaborators)
  116. .should.equal(true)
  117. })
  118. })
  119. describe('when the user has features', function() {
  120. beforeEach(function() {
  121. this.user.features = { collaborators: 21 }
  122. this.callback = sinon.stub()
  123. return this.LimitationsManager.allowedNumberOfCollaboratorsForUser(
  124. this.user_id,
  125. this.callback
  126. )
  127. })
  128. it('should return the number of collaborators the user is allowed', function() {
  129. return this.callback
  130. .calledWith(null, this.user.features.collaborators)
  131. .should.equal(true)
  132. })
  133. })
  134. })
  135. describe('canAddXCollaborators', function() {
  136. describe('when the project has fewer collaborators than allowed', function() {
  137. beforeEach(function() {
  138. this.current_number = 1
  139. this.allowed_number = 2
  140. this.invite_count = 0
  141. this.CollaboratorsGetter.getInvitedCollaboratorCount = (
  142. project_id,
  143. callback
  144. ) => callback(null, this.current_number)
  145. this.CollaboratorsInviteHandler.getInviteCount = (
  146. project_id,
  147. callback
  148. ) => callback(null, this.invite_count)
  149. sinon
  150. .stub(
  151. this.LimitationsManager,
  152. 'allowedNumberOfCollaboratorsInProject'
  153. )
  154. .callsFake((project_id, callback) => {
  155. return callback(null, this.allowed_number)
  156. })
  157. this.callback = sinon.stub()
  158. return this.LimitationsManager.canAddXCollaborators(
  159. this.project_id,
  160. 1,
  161. this.callback
  162. )
  163. })
  164. it('should return true', function() {
  165. return this.callback.calledWith(null, true).should.equal(true)
  166. })
  167. })
  168. describe('when the project has fewer collaborators and invites than allowed', function() {
  169. beforeEach(function() {
  170. this.current_number = 1
  171. this.allowed_number = 4
  172. this.invite_count = 1
  173. this.CollaboratorsGetter.getInvitedCollaboratorCount = (
  174. project_id,
  175. callback
  176. ) => callback(null, this.current_number)
  177. this.CollaboratorsInviteHandler.getInviteCount = (
  178. project_id,
  179. callback
  180. ) => callback(null, this.invite_count)
  181. sinon
  182. .stub(
  183. this.LimitationsManager,
  184. 'allowedNumberOfCollaboratorsInProject'
  185. )
  186. .callsFake((project_id, callback) => {
  187. return callback(null, this.allowed_number)
  188. })
  189. this.callback = sinon.stub()
  190. return this.LimitationsManager.canAddXCollaborators(
  191. this.project_id,
  192. 1,
  193. this.callback
  194. )
  195. })
  196. it('should return true', function() {
  197. return this.callback.calledWith(null, true).should.equal(true)
  198. })
  199. })
  200. describe('when the project has fewer collaborators than allowed but I want to add more than allowed', function() {
  201. beforeEach(function() {
  202. this.current_number = 1
  203. this.allowed_number = 2
  204. this.invite_count = 0
  205. this.CollaboratorsGetter.getInvitedCollaboratorCount = (
  206. project_id,
  207. callback
  208. ) => callback(null, this.current_number)
  209. this.CollaboratorsInviteHandler.getInviteCount = (
  210. project_id,
  211. callback
  212. ) => callback(null, this.invite_count)
  213. sinon
  214. .stub(
  215. this.LimitationsManager,
  216. 'allowedNumberOfCollaboratorsInProject'
  217. )
  218. .callsFake((project_id, callback) => {
  219. return callback(null, this.allowed_number)
  220. })
  221. this.callback = sinon.stub()
  222. return this.LimitationsManager.canAddXCollaborators(
  223. this.project_id,
  224. 2,
  225. this.callback
  226. )
  227. })
  228. it('should return false', function() {
  229. return this.callback.calledWith(null, false).should.equal(true)
  230. })
  231. })
  232. describe('when the project has more collaborators than allowed', function() {
  233. beforeEach(function() {
  234. this.current_number = 3
  235. this.allowed_number = 2
  236. this.invite_count = 0
  237. this.CollaboratorsGetter.getInvitedCollaboratorCount = (
  238. project_id,
  239. callback
  240. ) => callback(null, this.current_number)
  241. this.CollaboratorsInviteHandler.getInviteCount = (
  242. project_id,
  243. callback
  244. ) => callback(null, this.invite_count)
  245. sinon
  246. .stub(
  247. this.LimitationsManager,
  248. 'allowedNumberOfCollaboratorsInProject'
  249. )
  250. .callsFake((project_id, callback) => {
  251. return callback(null, this.allowed_number)
  252. })
  253. this.callback = sinon.stub()
  254. return this.LimitationsManager.canAddXCollaborators(
  255. this.project_id,
  256. 1,
  257. this.callback
  258. )
  259. })
  260. it('should return false', function() {
  261. return this.callback.calledWith(null, false).should.equal(true)
  262. })
  263. })
  264. describe('when the project has infinite collaborators', function() {
  265. beforeEach(function() {
  266. this.current_number = 100
  267. this.allowed_number = -1
  268. this.invite_count = 0
  269. this.CollaboratorsGetter.getInvitedCollaboratorCount = (
  270. project_id,
  271. callback
  272. ) => callback(null, this.current_number)
  273. this.CollaboratorsInviteHandler.getInviteCount = (
  274. project_id,
  275. callback
  276. ) => callback(null, this.invite_count)
  277. sinon
  278. .stub(
  279. this.LimitationsManager,
  280. 'allowedNumberOfCollaboratorsInProject'
  281. )
  282. .callsFake((project_id, callback) => {
  283. return callback(null, this.allowed_number)
  284. })
  285. this.callback = sinon.stub()
  286. return this.LimitationsManager.canAddXCollaborators(
  287. this.project_id,
  288. 1,
  289. this.callback
  290. )
  291. })
  292. it('should return true', function() {
  293. return this.callback.calledWith(null, true).should.equal(true)
  294. })
  295. })
  296. describe('when the project has more invites than allowed', function() {
  297. beforeEach(function() {
  298. this.current_number = 0
  299. this.allowed_number = 2
  300. this.invite_count = 2
  301. this.CollaboratorsGetter.getInvitedCollaboratorCount = (
  302. project_id,
  303. callback
  304. ) => callback(null, this.current_number)
  305. this.CollaboratorsInviteHandler.getInviteCount = (
  306. project_id,
  307. callback
  308. ) => callback(null, this.invite_count)
  309. sinon
  310. .stub(
  311. this.LimitationsManager,
  312. 'allowedNumberOfCollaboratorsInProject'
  313. )
  314. .callsFake((project_id, callback) => {
  315. return callback(null, this.allowed_number)
  316. })
  317. this.callback = sinon.stub()
  318. return this.LimitationsManager.canAddXCollaborators(
  319. this.project_id,
  320. 1,
  321. this.callback
  322. )
  323. })
  324. it('should return false', function() {
  325. return this.callback.calledWith(null, false).should.equal(true)
  326. })
  327. })
  328. describe('when the project has more invites and collaborators than allowed', function() {
  329. beforeEach(function() {
  330. this.current_number = 1
  331. this.allowed_number = 2
  332. this.invite_count = 1
  333. this.CollaboratorsGetter.getInvitedCollaboratorCount = (
  334. project_id,
  335. callback
  336. ) => callback(null, this.current_number)
  337. this.CollaboratorsInviteHandler.getInviteCount = (
  338. project_id,
  339. callback
  340. ) => callback(null, this.invite_count)
  341. sinon
  342. .stub(
  343. this.LimitationsManager,
  344. 'allowedNumberOfCollaboratorsInProject'
  345. )
  346. .callsFake((project_id, callback) => {
  347. return callback(null, this.allowed_number)
  348. })
  349. this.callback = sinon.stub()
  350. return this.LimitationsManager.canAddXCollaborators(
  351. this.project_id,
  352. 1,
  353. this.callback
  354. )
  355. })
  356. it('should return false', function() {
  357. return this.callback.calledWith(null, false).should.equal(true)
  358. })
  359. })
  360. })
  361. describe('userHasV2Subscription', function() {
  362. beforeEach(function() {
  363. return (this.SubscriptionLocator.getUsersSubscription = sinon.stub())
  364. })
  365. it('should return true if the recurly token is set', function(done) {
  366. this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {
  367. recurlySubscription_id: '1234'
  368. })
  369. return this.LimitationsManager.userHasV2Subscription(
  370. this.user,
  371. (err, hasSubscription) => {
  372. hasSubscription.should.equal(true)
  373. return done()
  374. }
  375. )
  376. })
  377. it('should return false if the recurly token is not set', function(done) {
  378. this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
  379. this.subscription = {}
  380. return this.LimitationsManager.userHasV2Subscription(
  381. this.user,
  382. (err, hasSubscription) => {
  383. hasSubscription.should.equal(false)
  384. return done()
  385. }
  386. )
  387. })
  388. it('should return false if the subscription is undefined', function(done) {
  389. this.SubscriptionLocator.getUsersSubscription.callsArgWith(1)
  390. return this.LimitationsManager.userHasV2Subscription(
  391. this.user,
  392. (err, hasSubscription) => {
  393. hasSubscription.should.equal(false)
  394. return done()
  395. }
  396. )
  397. })
  398. it('should return the subscription', function(done) {
  399. const stubbedSubscription = { freeTrial: {}, token: '' }
  400. this.SubscriptionLocator.getUsersSubscription.callsArgWith(
  401. 1,
  402. null,
  403. stubbedSubscription
  404. )
  405. return this.LimitationsManager.userHasV2Subscription(
  406. this.user,
  407. (err, hasSubOrIsGroupMember, subscription) => {
  408. subscription.should.deep.equal(stubbedSubscription)
  409. return done()
  410. }
  411. )
  412. })
  413. describe('when user has a custom account', function() {
  414. beforeEach(function() {
  415. this.fakeSubscription = { customAccount: true }
  416. return this.SubscriptionLocator.getUsersSubscription.callsArgWith(
  417. 1,
  418. null,
  419. this.fakeSubscription
  420. )
  421. })
  422. it('should return true', function(done) {
  423. return this.LimitationsManager.userHasV2Subscription(
  424. this.user,
  425. (err, hasSubscription, subscription) => {
  426. hasSubscription.should.equal(true)
  427. return done()
  428. }
  429. )
  430. })
  431. it('should return the subscription', function(done) {
  432. return this.LimitationsManager.userHasV2Subscription(
  433. this.user,
  434. (err, hasSubscription, subscription) => {
  435. subscription.should.deep.equal(this.fakeSubscription)
  436. return done()
  437. }
  438. )
  439. })
  440. })
  441. })
  442. describe('userIsMemberOfGroupSubscription', function() {
  443. beforeEach(function() {
  444. return (this.SubscriptionLocator.getMemberSubscriptions = sinon.stub())
  445. })
  446. it('should return false if there are no groups subcriptions', function(done) {
  447. this.SubscriptionLocator.getMemberSubscriptions.callsArgWith(1, null, [])
  448. return this.LimitationsManager.userIsMemberOfGroupSubscription(
  449. this.user,
  450. (err, isMember) => {
  451. isMember.should.equal(false)
  452. return done()
  453. }
  454. )
  455. })
  456. it('should return true if there are no groups subcriptions', function(done) {
  457. let subscriptions
  458. this.SubscriptionLocator.getMemberSubscriptions.callsArgWith(
  459. 1,
  460. null,
  461. (subscriptions = ['mock-subscription'])
  462. )
  463. return this.LimitationsManager.userIsMemberOfGroupSubscription(
  464. this.user,
  465. (err, isMember, retSubscriptions) => {
  466. isMember.should.equal(true)
  467. retSubscriptions.should.equal(subscriptions)
  468. return done()
  469. }
  470. )
  471. })
  472. })
  473. describe('hasPaidSubscription', function() {
  474. beforeEach(function() {
  475. this.LimitationsManager.userIsMemberOfGroupSubscription = sinon
  476. .stub()
  477. .yields(null, false)
  478. this.LimitationsManager.userHasV2Subscription = sinon
  479. .stub()
  480. .yields(null, false)
  481. return (this.LimitationsManager.userHasV1Subscription = sinon
  482. .stub()
  483. .yields(null, false))
  484. })
  485. it('should return true if userIsMemberOfGroupSubscription', function(done) {
  486. this.LimitationsManager.userIsMemberOfGroupSubscription = sinon
  487. .stub()
  488. .yields(null, true)
  489. return this.LimitationsManager.hasPaidSubscription(
  490. this.user,
  491. (err, hasSubOrIsGroupMember) => {
  492. hasSubOrIsGroupMember.should.equal(true)
  493. return done()
  494. }
  495. )
  496. })
  497. it('should return true if userHasV2Subscription', function(done) {
  498. this.LimitationsManager.userHasV2Subscription = sinon
  499. .stub()
  500. .yields(null, true)
  501. return this.LimitationsManager.hasPaidSubscription(
  502. this.user,
  503. (err, hasSubOrIsGroupMember) => {
  504. hasSubOrIsGroupMember.should.equal(true)
  505. return done()
  506. }
  507. )
  508. })
  509. it('should return true if userHasV1Subscription', function(done) {
  510. this.LimitationsManager.userHasV1Subscription = sinon
  511. .stub()
  512. .yields(null, true)
  513. return this.LimitationsManager.hasPaidSubscription(
  514. this.user,
  515. (err, hasSubOrIsGroupMember) => {
  516. hasSubOrIsGroupMember.should.equal(true)
  517. return done()
  518. }
  519. )
  520. })
  521. it('should return false if none are true', function(done) {
  522. return this.LimitationsManager.hasPaidSubscription(
  523. this.user,
  524. (err, hasSubOrIsGroupMember) => {
  525. hasSubOrIsGroupMember.should.equal(false)
  526. return done()
  527. }
  528. )
  529. })
  530. it('should have userHasSubscriptionOrIsGroupMember alias', function(done) {
  531. return this.LimitationsManager.userHasSubscriptionOrIsGroupMember(
  532. this.user,
  533. (err, hasSubOrIsGroupMember) => {
  534. hasSubOrIsGroupMember.should.equal(false)
  535. return done()
  536. }
  537. )
  538. })
  539. })
  540. describe('userHasV1OrV2Subscription', function() {
  541. beforeEach(function() {
  542. this.LimitationsManager.userHasV2Subscription = sinon
  543. .stub()
  544. .yields(null, false)
  545. return (this.LimitationsManager.userHasV1Subscription = sinon
  546. .stub()
  547. .yields(null, false))
  548. })
  549. it('should return true if userHasV2Subscription', function(done) {
  550. this.LimitationsManager.userHasV2Subscription = sinon
  551. .stub()
  552. .yields(null, true)
  553. return this.LimitationsManager.userHasV1OrV2Subscription(
  554. this.user,
  555. (err, hasSub) => {
  556. hasSub.should.equal(true)
  557. return done()
  558. }
  559. )
  560. })
  561. it('should return true if userHasV1Subscription', function(done) {
  562. this.LimitationsManager.userHasV1Subscription = sinon
  563. .stub()
  564. .yields(null, true)
  565. return this.LimitationsManager.userHasV1OrV2Subscription(
  566. this.user,
  567. (err, hasSub) => {
  568. hasSub.should.equal(true)
  569. return done()
  570. }
  571. )
  572. })
  573. it('should return false if none are true', function(done) {
  574. return this.LimitationsManager.userHasV1OrV2Subscription(
  575. this.user,
  576. (err, hasSub) => {
  577. hasSub.should.equal(false)
  578. return done()
  579. }
  580. )
  581. })
  582. })
  583. describe('hasGroupMembersLimitReached', function() {
  584. beforeEach(function() {
  585. this.subscriptionId = '12312'
  586. return (this.subscription = {
  587. membersLimit: 3,
  588. member_ids: ['', ''],
  589. teamInvites: [
  590. { email: 'bob@example.com', sentAt: new Date(), token: 'hey' }
  591. ]
  592. })
  593. })
  594. it('should return true if the limit is hit (including members and invites)', function(done) {
  595. this.SubscriptionLocator.getSubscription.callsArgWith(
  596. 1,
  597. null,
  598. this.subscription
  599. )
  600. return this.LimitationsManager.hasGroupMembersLimitReached(
  601. this.subscriptionId,
  602. (err, limitReached) => {
  603. limitReached.should.equal(true)
  604. return done()
  605. }
  606. )
  607. })
  608. it('should return false if the limit is not hit (including members and invites)', function(done) {
  609. this.subscription.membersLimit = 4
  610. this.SubscriptionLocator.getSubscription.callsArgWith(
  611. 1,
  612. null,
  613. this.subscription
  614. )
  615. return this.LimitationsManager.hasGroupMembersLimitReached(
  616. this.subscriptionId,
  617. (err, limitReached) => {
  618. limitReached.should.equal(false)
  619. return done()
  620. }
  621. )
  622. })
  623. it('should return true if the limit has been exceded (including members and invites)', function(done) {
  624. this.subscription.membersLimit = 2
  625. this.SubscriptionLocator.getSubscription.callsArgWith(
  626. 1,
  627. null,
  628. this.subscription
  629. )
  630. return this.LimitationsManager.hasGroupMembersLimitReached(
  631. this.subscriptionId,
  632. (err, limitReached) => {
  633. limitReached.should.equal(true)
  634. return done()
  635. }
  636. )
  637. })
  638. })
  639. describe('userHasV1Subscription', function() {
  640. it('should return true if v1 returns has_subscription = true', function(done) {
  641. this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
  642. .stub()
  643. .yields(null, { has_subscription: true })
  644. return this.LimitationsManager.userHasV1Subscription(
  645. this.user,
  646. (error, result) => {
  647. this.V1SubscriptionManager.getSubscriptionsFromV1
  648. .calledWith(this.user_id)
  649. .should.equal(true)
  650. result.should.equal(true)
  651. return done()
  652. }
  653. )
  654. })
  655. it('should return false if v1 returns has_subscription = false', function(done) {
  656. this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
  657. .stub()
  658. .yields(null, { has_subscription: false })
  659. return this.LimitationsManager.userHasV1Subscription(
  660. this.user,
  661. (error, result) => {
  662. this.V1SubscriptionManager.getSubscriptionsFromV1
  663. .calledWith(this.user_id)
  664. .should.equal(true)
  665. result.should.equal(false)
  666. return done()
  667. }
  668. )
  669. })
  670. it('should return false if v1 returns nothing', function(done) {
  671. this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
  672. .stub()
  673. .yields(null, null)
  674. return this.LimitationsManager.userHasV1Subscription(
  675. this.user,
  676. (error, result) => {
  677. this.V1SubscriptionManager.getSubscriptionsFromV1
  678. .calledWith(this.user_id)
  679. .should.equal(true)
  680. result.should.equal(false)
  681. return done()
  682. }
  683. )
  684. })
  685. })
  686. })