LimitationsManagerTests.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  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/CollaboratorsHandler': (this.CollaboratorsHandler = {}),
  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.CollaboratorsHandler.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.stub(
  150. this.LimitationsManager,
  151. 'allowedNumberOfCollaboratorsInProject',
  152. (project_id, callback) => {
  153. return callback(null, this.allowed_number)
  154. }
  155. )
  156. this.callback = sinon.stub()
  157. return this.LimitationsManager.canAddXCollaborators(
  158. this.project_id,
  159. 1,
  160. this.callback
  161. )
  162. })
  163. it('should return true', function() {
  164. return this.callback.calledWith(null, true).should.equal(true)
  165. })
  166. })
  167. describe('when the project has fewer collaborators and invites than allowed', function() {
  168. beforeEach(function() {
  169. this.current_number = 1
  170. this.allowed_number = 4
  171. this.invite_count = 1
  172. this.CollaboratorsHandler.getInvitedCollaboratorCount = (
  173. project_id,
  174. callback
  175. ) => callback(null, this.current_number)
  176. this.CollaboratorsInviteHandler.getInviteCount = (
  177. project_id,
  178. callback
  179. ) => callback(null, this.invite_count)
  180. sinon.stub(
  181. this.LimitationsManager,
  182. 'allowedNumberOfCollaboratorsInProject',
  183. (project_id, callback) => {
  184. return callback(null, this.allowed_number)
  185. }
  186. )
  187. this.callback = sinon.stub()
  188. return this.LimitationsManager.canAddXCollaborators(
  189. this.project_id,
  190. 1,
  191. this.callback
  192. )
  193. })
  194. it('should return true', function() {
  195. return this.callback.calledWith(null, true).should.equal(true)
  196. })
  197. })
  198. describe('when the project has fewer collaborators than allowed but I want to add more than allowed', function() {
  199. beforeEach(function() {
  200. this.current_number = 1
  201. this.allowed_number = 2
  202. this.invite_count = 0
  203. this.CollaboratorsHandler.getInvitedCollaboratorCount = (
  204. project_id,
  205. callback
  206. ) => callback(null, this.current_number)
  207. this.CollaboratorsInviteHandler.getInviteCount = (
  208. project_id,
  209. callback
  210. ) => callback(null, this.invite_count)
  211. sinon.stub(
  212. this.LimitationsManager,
  213. 'allowedNumberOfCollaboratorsInProject',
  214. (project_id, callback) => {
  215. return callback(null, this.allowed_number)
  216. }
  217. )
  218. this.callback = sinon.stub()
  219. return this.LimitationsManager.canAddXCollaborators(
  220. this.project_id,
  221. 2,
  222. this.callback
  223. )
  224. })
  225. it('should return false', function() {
  226. return this.callback.calledWith(null, false).should.equal(true)
  227. })
  228. })
  229. describe('when the project has more collaborators than allowed', function() {
  230. beforeEach(function() {
  231. this.current_number = 3
  232. this.allowed_number = 2
  233. this.invite_count = 0
  234. this.CollaboratorsHandler.getInvitedCollaboratorCount = (
  235. project_id,
  236. callback
  237. ) => callback(null, this.current_number)
  238. this.CollaboratorsInviteHandler.getInviteCount = (
  239. project_id,
  240. callback
  241. ) => callback(null, this.invite_count)
  242. sinon.stub(
  243. this.LimitationsManager,
  244. 'allowedNumberOfCollaboratorsInProject',
  245. (project_id, callback) => {
  246. return callback(null, this.allowed_number)
  247. }
  248. )
  249. this.callback = sinon.stub()
  250. return this.LimitationsManager.canAddXCollaborators(
  251. this.project_id,
  252. 1,
  253. this.callback
  254. )
  255. })
  256. it('should return false', function() {
  257. return this.callback.calledWith(null, false).should.equal(true)
  258. })
  259. })
  260. describe('when the project has infinite collaborators', function() {
  261. beforeEach(function() {
  262. this.current_number = 100
  263. this.allowed_number = -1
  264. this.invite_count = 0
  265. this.CollaboratorsHandler.getInvitedCollaboratorCount = (
  266. project_id,
  267. callback
  268. ) => callback(null, this.current_number)
  269. this.CollaboratorsInviteHandler.getInviteCount = (
  270. project_id,
  271. callback
  272. ) => callback(null, this.invite_count)
  273. sinon.stub(
  274. this.LimitationsManager,
  275. 'allowedNumberOfCollaboratorsInProject',
  276. (project_id, callback) => {
  277. return callback(null, this.allowed_number)
  278. }
  279. )
  280. this.callback = sinon.stub()
  281. return this.LimitationsManager.canAddXCollaborators(
  282. this.project_id,
  283. 1,
  284. this.callback
  285. )
  286. })
  287. it('should return true', function() {
  288. return this.callback.calledWith(null, true).should.equal(true)
  289. })
  290. })
  291. describe('when the project has more invites than allowed', function() {
  292. beforeEach(function() {
  293. this.current_number = 0
  294. this.allowed_number = 2
  295. this.invite_count = 2
  296. this.CollaboratorsHandler.getInvitedCollaboratorCount = (
  297. project_id,
  298. callback
  299. ) => callback(null, this.current_number)
  300. this.CollaboratorsInviteHandler.getInviteCount = (
  301. project_id,
  302. callback
  303. ) => callback(null, this.invite_count)
  304. sinon.stub(
  305. this.LimitationsManager,
  306. 'allowedNumberOfCollaboratorsInProject',
  307. (project_id, callback) => {
  308. return callback(null, this.allowed_number)
  309. }
  310. )
  311. this.callback = sinon.stub()
  312. return this.LimitationsManager.canAddXCollaborators(
  313. this.project_id,
  314. 1,
  315. this.callback
  316. )
  317. })
  318. it('should return false', function() {
  319. return this.callback.calledWith(null, false).should.equal(true)
  320. })
  321. })
  322. describe('when the project has more invites and collaborators than allowed', function() {
  323. beforeEach(function() {
  324. this.current_number = 1
  325. this.allowed_number = 2
  326. this.invite_count = 1
  327. this.CollaboratorsHandler.getInvitedCollaboratorCount = (
  328. project_id,
  329. callback
  330. ) => callback(null, this.current_number)
  331. this.CollaboratorsInviteHandler.getInviteCount = (
  332. project_id,
  333. callback
  334. ) => callback(null, this.invite_count)
  335. sinon.stub(
  336. this.LimitationsManager,
  337. 'allowedNumberOfCollaboratorsInProject',
  338. (project_id, callback) => {
  339. return callback(null, this.allowed_number)
  340. }
  341. )
  342. this.callback = sinon.stub()
  343. return this.LimitationsManager.canAddXCollaborators(
  344. this.project_id,
  345. 1,
  346. this.callback
  347. )
  348. })
  349. it('should return false', function() {
  350. return this.callback.calledWith(null, false).should.equal(true)
  351. })
  352. })
  353. })
  354. describe('userHasV2Subscription', function() {
  355. beforeEach(function() {
  356. return (this.SubscriptionLocator.getUsersSubscription = sinon.stub())
  357. })
  358. it('should return true if the recurly token is set', function(done) {
  359. this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {
  360. recurlySubscription_id: '1234'
  361. })
  362. return this.LimitationsManager.userHasV2Subscription(this.user, function(
  363. err,
  364. hasSubscription
  365. ) {
  366. hasSubscription.should.equal(true)
  367. return done()
  368. })
  369. })
  370. it('should return false if the recurly token is not set', function(done) {
  371. this.SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
  372. this.subscription = {}
  373. return this.LimitationsManager.userHasV2Subscription(this.user, function(
  374. err,
  375. hasSubscription
  376. ) {
  377. hasSubscription.should.equal(false)
  378. return done()
  379. })
  380. })
  381. it('should return false if the subscription is undefined', function(done) {
  382. this.SubscriptionLocator.getUsersSubscription.callsArgWith(1)
  383. return this.LimitationsManager.userHasV2Subscription(this.user, function(
  384. err,
  385. hasSubscription
  386. ) {
  387. hasSubscription.should.equal(false)
  388. return done()
  389. })
  390. })
  391. it('should return the subscription', function(done) {
  392. const stubbedSubscription = { freeTrial: {}, token: '' }
  393. this.SubscriptionLocator.getUsersSubscription.callsArgWith(
  394. 1,
  395. null,
  396. stubbedSubscription
  397. )
  398. return this.LimitationsManager.userHasV2Subscription(this.user, function(
  399. err,
  400. hasSubOrIsGroupMember,
  401. subscription
  402. ) {
  403. subscription.should.deep.equal(stubbedSubscription)
  404. return done()
  405. })
  406. })
  407. describe('when user has a custom account', function() {
  408. beforeEach(function() {
  409. this.fakeSubscription = { customAccount: true }
  410. return this.SubscriptionLocator.getUsersSubscription.callsArgWith(
  411. 1,
  412. null,
  413. this.fakeSubscription
  414. )
  415. })
  416. it('should return true', function(done) {
  417. return this.LimitationsManager.userHasV2Subscription(
  418. this.user,
  419. function(err, hasSubscription, subscription) {
  420. hasSubscription.should.equal(true)
  421. return done()
  422. }
  423. )
  424. })
  425. it('should return the subscription', function(done) {
  426. return this.LimitationsManager.userHasV2Subscription(
  427. this.user,
  428. (err, hasSubscription, subscription) => {
  429. subscription.should.deep.equal(this.fakeSubscription)
  430. return done()
  431. }
  432. )
  433. })
  434. })
  435. })
  436. describe('userIsMemberOfGroupSubscription', function() {
  437. beforeEach(function() {
  438. return (this.SubscriptionLocator.getMemberSubscriptions = sinon.stub())
  439. })
  440. it('should return false if there are no groups subcriptions', function(done) {
  441. this.SubscriptionLocator.getMemberSubscriptions.callsArgWith(1, null, [])
  442. return this.LimitationsManager.userIsMemberOfGroupSubscription(
  443. this.user,
  444. function(err, isMember) {
  445. isMember.should.equal(false)
  446. return done()
  447. }
  448. )
  449. })
  450. it('should return true if there are no groups subcriptions', function(done) {
  451. let subscriptions
  452. this.SubscriptionLocator.getMemberSubscriptions.callsArgWith(
  453. 1,
  454. null,
  455. (subscriptions = ['mock-subscription'])
  456. )
  457. return this.LimitationsManager.userIsMemberOfGroupSubscription(
  458. this.user,
  459. function(err, isMember, retSubscriptions) {
  460. isMember.should.equal(true)
  461. retSubscriptions.should.equal(subscriptions)
  462. return done()
  463. }
  464. )
  465. })
  466. })
  467. describe('hasPaidSubscription', function() {
  468. beforeEach(function() {
  469. this.LimitationsManager.userIsMemberOfGroupSubscription = sinon
  470. .stub()
  471. .yields(null, false)
  472. this.LimitationsManager.userHasV2Subscription = sinon
  473. .stub()
  474. .yields(null, false)
  475. return (this.LimitationsManager.userHasV1Subscription = sinon
  476. .stub()
  477. .yields(null, false))
  478. })
  479. it('should return true if userIsMemberOfGroupSubscription', function(done) {
  480. this.LimitationsManager.userIsMemberOfGroupSubscription = sinon
  481. .stub()
  482. .yields(null, true)
  483. return this.LimitationsManager.hasPaidSubscription(this.user, function(
  484. err,
  485. hasSubOrIsGroupMember
  486. ) {
  487. hasSubOrIsGroupMember.should.equal(true)
  488. return done()
  489. })
  490. })
  491. it('should return true if userHasV2Subscription', function(done) {
  492. this.LimitationsManager.userHasV2Subscription = sinon
  493. .stub()
  494. .yields(null, true)
  495. return this.LimitationsManager.hasPaidSubscription(this.user, function(
  496. err,
  497. hasSubOrIsGroupMember
  498. ) {
  499. hasSubOrIsGroupMember.should.equal(true)
  500. return done()
  501. })
  502. })
  503. it('should return true if userHasV1Subscription', function(done) {
  504. this.LimitationsManager.userHasV1Subscription = sinon
  505. .stub()
  506. .yields(null, true)
  507. return this.LimitationsManager.hasPaidSubscription(this.user, function(
  508. err,
  509. hasSubOrIsGroupMember
  510. ) {
  511. hasSubOrIsGroupMember.should.equal(true)
  512. return done()
  513. })
  514. })
  515. it('should return false if none are true', function(done) {
  516. return this.LimitationsManager.hasPaidSubscription(this.user, function(
  517. err,
  518. hasSubOrIsGroupMember
  519. ) {
  520. hasSubOrIsGroupMember.should.equal(false)
  521. return done()
  522. })
  523. })
  524. it('should have userHasSubscriptionOrIsGroupMember alias', function(done) {
  525. return this.LimitationsManager.userHasSubscriptionOrIsGroupMember(
  526. this.user,
  527. function(err, hasSubOrIsGroupMember) {
  528. hasSubOrIsGroupMember.should.equal(false)
  529. return done()
  530. }
  531. )
  532. })
  533. })
  534. describe('userHasV1OrV2Subscription', function() {
  535. beforeEach(function() {
  536. this.LimitationsManager.userHasV2Subscription = sinon
  537. .stub()
  538. .yields(null, false)
  539. return (this.LimitationsManager.userHasV1Subscription = sinon
  540. .stub()
  541. .yields(null, false))
  542. })
  543. it('should return true if userHasV2Subscription', function(done) {
  544. this.LimitationsManager.userHasV2Subscription = sinon
  545. .stub()
  546. .yields(null, true)
  547. return this.LimitationsManager.userHasV1OrV2Subscription(
  548. this.user,
  549. function(err, hasSub) {
  550. hasSub.should.equal(true)
  551. return done()
  552. }
  553. )
  554. })
  555. it('should return true if userHasV1Subscription', function(done) {
  556. this.LimitationsManager.userHasV1Subscription = sinon
  557. .stub()
  558. .yields(null, true)
  559. return this.LimitationsManager.userHasV1OrV2Subscription(
  560. this.user,
  561. function(err, hasSub) {
  562. hasSub.should.equal(true)
  563. return done()
  564. }
  565. )
  566. })
  567. it('should return false if none are true', function(done) {
  568. return this.LimitationsManager.userHasV1OrV2Subscription(
  569. this.user,
  570. function(err, hasSub) {
  571. hasSub.should.equal(false)
  572. return done()
  573. }
  574. )
  575. })
  576. })
  577. describe('hasGroupMembersLimitReached', function() {
  578. beforeEach(function() {
  579. this.subscriptionId = '12312'
  580. return (this.subscription = {
  581. membersLimit: 3,
  582. member_ids: ['', ''],
  583. teamInvites: [
  584. { email: 'bob@example.com', sentAt: new Date(), token: 'hey' }
  585. ]
  586. })
  587. })
  588. it('should return true if the limit is hit (including members and invites)', function(done) {
  589. this.SubscriptionLocator.getSubscription.callsArgWith(
  590. 1,
  591. null,
  592. this.subscription
  593. )
  594. return this.LimitationsManager.hasGroupMembersLimitReached(
  595. this.subscriptionId,
  596. function(err, limitReached) {
  597. limitReached.should.equal(true)
  598. return done()
  599. }
  600. )
  601. })
  602. it('should return false if the limit is not hit (including members and invites)', function(done) {
  603. this.subscription.membersLimit = 4
  604. this.SubscriptionLocator.getSubscription.callsArgWith(
  605. 1,
  606. null,
  607. this.subscription
  608. )
  609. return this.LimitationsManager.hasGroupMembersLimitReached(
  610. this.subscriptionId,
  611. function(err, limitReached) {
  612. limitReached.should.equal(false)
  613. return done()
  614. }
  615. )
  616. })
  617. it('should return true if the limit has been exceded (including members and invites)', function(done) {
  618. this.subscription.membersLimit = 2
  619. this.SubscriptionLocator.getSubscription.callsArgWith(
  620. 1,
  621. null,
  622. this.subscription
  623. )
  624. return this.LimitationsManager.hasGroupMembersLimitReached(
  625. this.subscriptionId,
  626. function(err, limitReached) {
  627. limitReached.should.equal(true)
  628. return done()
  629. }
  630. )
  631. })
  632. })
  633. describe('userHasV1Subscription', function() {
  634. it('should return true if v1 returns has_subscription = true', function(done) {
  635. this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
  636. .stub()
  637. .yields(null, { has_subscription: true })
  638. return this.LimitationsManager.userHasV1Subscription(
  639. this.user,
  640. (error, result) => {
  641. this.V1SubscriptionManager.getSubscriptionsFromV1
  642. .calledWith(this.user_id)
  643. .should.equal(true)
  644. result.should.equal(true)
  645. return done()
  646. }
  647. )
  648. })
  649. it('should return false if v1 returns has_subscription = false', function(done) {
  650. this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
  651. .stub()
  652. .yields(null, { has_subscription: false })
  653. return this.LimitationsManager.userHasV1Subscription(
  654. this.user,
  655. (error, result) => {
  656. this.V1SubscriptionManager.getSubscriptionsFromV1
  657. .calledWith(this.user_id)
  658. .should.equal(true)
  659. result.should.equal(false)
  660. return done()
  661. }
  662. )
  663. })
  664. it('should return false if v1 returns nothing', function(done) {
  665. this.V1SubscriptionManager.getSubscriptionsFromV1 = sinon
  666. .stub()
  667. .yields(null, null)
  668. return this.LimitationsManager.userHasV1Subscription(
  669. this.user,
  670. (error, result) => {
  671. this.V1SubscriptionManager.getSubscriptionsFromV1
  672. .calledWith(this.user_id)
  673. .should.equal(true)
  674. result.should.equal(false)
  675. return done()
  676. }
  677. )
  678. })
  679. })
  680. })