UserSessionsManagerTests.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. /* eslint-disable
  2. n/handle-callback-err,
  3. max-len,
  4. no-return-assign,
  5. no-unused-vars,
  6. */
  7. // TODO: This file was created by bulk-decaffeinate.
  8. // Fix any style issues and re-enable lint.
  9. /*
  10. * decaffeinate suggestions:
  11. * DS102: Remove unnecessary code created because of implicit returns
  12. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  13. */
  14. const sinon = require('sinon')
  15. const { expect } = require('chai')
  16. const modulePath = '../../../../app/src/Features/User/UserSessionsManager.js'
  17. const SandboxedModule = require('sandboxed-module')
  18. describe('UserSessionsManager', function () {
  19. beforeEach(function () {
  20. this.user = {
  21. _id: 'abcd',
  22. email: 'user@example.com',
  23. }
  24. this.sessionId = 'some_session_id'
  25. this.rclient = {
  26. multi: sinon.stub(),
  27. exec: sinon.stub(),
  28. get: sinon.stub(),
  29. del: sinon.stub(),
  30. sadd: sinon.stub(),
  31. srem: sinon.stub(),
  32. smembers: sinon.stub(),
  33. mget: sinon.stub(),
  34. pexpire: sinon.stub(),
  35. }
  36. this.rclient.multi.returns(this.rclient)
  37. this.rclient.get.returns(this.rclient)
  38. this.rclient.del.returns(this.rclient)
  39. this.rclient.sadd.returns(this.rclient)
  40. this.rclient.srem.returns(this.rclient)
  41. this.rclient.smembers.returns(this.rclient)
  42. this.rclient.pexpire.returns(this.rclient)
  43. this.rclient.exec.callsArgWith(0, null)
  44. this.UserSessionsRedis = {
  45. client: () => this.rclient,
  46. sessionSetKey: user => `UserSessions:{${user._id}}`,
  47. }
  48. this.settings = {
  49. redis: {
  50. web: {},
  51. },
  52. }
  53. return (this.UserSessionsManager = SandboxedModule.require(modulePath, {
  54. requires: {
  55. '@overleaf/settings': this.settings,
  56. './UserSessionsRedis': this.UserSessionsRedis,
  57. },
  58. }))
  59. })
  60. describe('_sessionKey', function () {
  61. it('should build the correct key', function () {
  62. const result = this.UserSessionsManager._sessionKey(this.sessionId)
  63. return result.should.equal('sess:some_session_id')
  64. })
  65. })
  66. describe('trackSession', function () {
  67. beforeEach(function () {
  68. this.call = callback => {
  69. return this.UserSessionsManager.trackSession(
  70. this.user,
  71. this.sessionId,
  72. callback
  73. )
  74. }
  75. this.rclient.exec.callsArgWith(0, null)
  76. return (this._checkSessions = sinon
  77. .stub(this.UserSessionsManager, '_checkSessions')
  78. .returns(null))
  79. })
  80. afterEach(function () {
  81. return this._checkSessions.restore()
  82. })
  83. it('should not produce an error', function (done) {
  84. return this.call(err => {
  85. expect(err).to.not.exist
  86. return done()
  87. })
  88. })
  89. it('should call the appropriate redis methods', function (done) {
  90. return this.call(err => {
  91. this.rclient.multi.callCount.should.equal(1)
  92. this.rclient.sadd.callCount.should.equal(1)
  93. this.rclient.pexpire.callCount.should.equal(1)
  94. this.rclient.exec.callCount.should.equal(1)
  95. return done()
  96. })
  97. })
  98. it('should call _checkSessions', function (done) {
  99. return this.call(err => {
  100. this._checkSessions.callCount.should.equal(1)
  101. return done()
  102. })
  103. })
  104. describe('when rclient produces an error', function () {
  105. beforeEach(function () {
  106. return this.rclient.exec.callsArgWith(0, new Error('woops'))
  107. })
  108. it('should produce an error', function (done) {
  109. return this.call(err => {
  110. expect(err).to.be.instanceof(Error)
  111. return done()
  112. })
  113. })
  114. it('should not call _checkSessions', function (done) {
  115. return this.call(err => {
  116. this._checkSessions.callCount.should.equal(0)
  117. return done()
  118. })
  119. })
  120. })
  121. describe('when no user is supplied', function () {
  122. beforeEach(function () {
  123. return (this.call = callback => {
  124. return this.UserSessionsManager.trackSession(
  125. null,
  126. this.sessionId,
  127. callback
  128. )
  129. })
  130. })
  131. it('should not produce an error', function (done) {
  132. return this.call(err => {
  133. expect(err).to.not.exist
  134. return done()
  135. })
  136. })
  137. it('should not call the appropriate redis methods', function (done) {
  138. return this.call(err => {
  139. this.rclient.multi.callCount.should.equal(0)
  140. this.rclient.sadd.callCount.should.equal(0)
  141. this.rclient.pexpire.callCount.should.equal(0)
  142. this.rclient.exec.callCount.should.equal(0)
  143. return done()
  144. })
  145. })
  146. it('should not call _checkSessions', function (done) {
  147. return this.call(err => {
  148. this._checkSessions.callCount.should.equal(0)
  149. return done()
  150. })
  151. })
  152. })
  153. describe('when no sessionId is supplied', function () {
  154. beforeEach(function () {
  155. return (this.call = callback => {
  156. return this.UserSessionsManager.trackSession(
  157. this.user,
  158. null,
  159. callback
  160. )
  161. })
  162. })
  163. it('should not produce an error', function (done) {
  164. return this.call(err => {
  165. expect(err).to.not.exist
  166. return done()
  167. })
  168. })
  169. it('should not call the appropriate redis methods', function (done) {
  170. return this.call(err => {
  171. this.rclient.multi.callCount.should.equal(0)
  172. this.rclient.sadd.callCount.should.equal(0)
  173. this.rclient.pexpire.callCount.should.equal(0)
  174. this.rclient.exec.callCount.should.equal(0)
  175. return done()
  176. })
  177. })
  178. it('should not call _checkSessions', function (done) {
  179. return this.call(err => {
  180. this._checkSessions.callCount.should.equal(0)
  181. return done()
  182. })
  183. })
  184. })
  185. })
  186. describe('untrackSession', function () {
  187. beforeEach(function () {
  188. this.call = callback => {
  189. return this.UserSessionsManager.untrackSession(
  190. this.user,
  191. this.sessionId,
  192. callback
  193. )
  194. }
  195. this.rclient.exec.callsArgWith(0, null)
  196. return (this._checkSessions = sinon
  197. .stub(this.UserSessionsManager, '_checkSessions')
  198. .returns(null))
  199. })
  200. afterEach(function () {
  201. return this._checkSessions.restore()
  202. })
  203. it('should not produce an error', function (done) {
  204. return this.call(err => {
  205. expect(err).to.not.exist
  206. return done()
  207. })
  208. })
  209. it('should call the appropriate redis methods', function (done) {
  210. return this.call(err => {
  211. this.rclient.multi.callCount.should.equal(1)
  212. this.rclient.srem.callCount.should.equal(1)
  213. this.rclient.pexpire.callCount.should.equal(1)
  214. this.rclient.exec.callCount.should.equal(1)
  215. return done()
  216. })
  217. })
  218. it('should call _checkSessions', function (done) {
  219. return this.call(err => {
  220. this._checkSessions.callCount.should.equal(1)
  221. return done()
  222. })
  223. })
  224. describe('when rclient produces an error', function () {
  225. beforeEach(function () {
  226. return this.rclient.exec.callsArgWith(0, new Error('woops'))
  227. })
  228. it('should produce an error', function (done) {
  229. return this.call(err => {
  230. expect(err).to.be.instanceof(Error)
  231. return done()
  232. })
  233. })
  234. it('should not call _checkSessions', function (done) {
  235. return this.call(err => {
  236. this._checkSessions.callCount.should.equal(0)
  237. return done()
  238. })
  239. })
  240. })
  241. describe('when no user is supplied', function () {
  242. beforeEach(function () {
  243. return (this.call = callback => {
  244. return this.UserSessionsManager.untrackSession(
  245. null,
  246. this.sessionId,
  247. callback
  248. )
  249. })
  250. })
  251. it('should not produce an error', function (done) {
  252. return this.call(err => {
  253. expect(err).to.not.exist
  254. return done()
  255. })
  256. })
  257. it('should not call the appropriate redis methods', function (done) {
  258. return this.call(err => {
  259. this.rclient.multi.callCount.should.equal(0)
  260. this.rclient.srem.callCount.should.equal(0)
  261. this.rclient.pexpire.callCount.should.equal(0)
  262. this.rclient.exec.callCount.should.equal(0)
  263. return done()
  264. })
  265. })
  266. it('should not call _checkSessions', function (done) {
  267. return this.call(err => {
  268. this._checkSessions.callCount.should.equal(0)
  269. return done()
  270. })
  271. })
  272. })
  273. describe('when no sessionId is supplied', function () {
  274. beforeEach(function () {
  275. return (this.call = callback => {
  276. return this.UserSessionsManager.untrackSession(
  277. this.user,
  278. null,
  279. callback
  280. )
  281. })
  282. })
  283. it('should not produce an error', function (done) {
  284. return this.call(err => {
  285. expect(err).to.not.exist
  286. return done()
  287. })
  288. })
  289. it('should not call the appropriate redis methods', function (done) {
  290. return this.call(err => {
  291. this.rclient.multi.callCount.should.equal(0)
  292. this.rclient.srem.callCount.should.equal(0)
  293. this.rclient.pexpire.callCount.should.equal(0)
  294. this.rclient.exec.callCount.should.equal(0)
  295. return done()
  296. })
  297. })
  298. it('should not call _checkSessions', function (done) {
  299. return this.call(err => {
  300. this._checkSessions.callCount.should.equal(0)
  301. return done()
  302. })
  303. })
  304. })
  305. })
  306. describe('revokeAllUserSessions', function () {
  307. beforeEach(function () {
  308. this.sessionKeys = ['sess:one', 'sess:two']
  309. this.retain = []
  310. this.rclient.smembers.callsArgWith(1, null, this.sessionKeys)
  311. this.rclient.del = sinon.stub().callsArgWith(1, null)
  312. this.rclient.srem = sinon.stub().callsArgWith(2, null)
  313. return (this.call = callback => {
  314. return this.UserSessionsManager.revokeAllUserSessions(
  315. this.user,
  316. this.retain,
  317. callback
  318. )
  319. })
  320. })
  321. it('should not produce an error', function (done) {
  322. return this.call(err => {
  323. expect(err).to.not.exist
  324. return done()
  325. })
  326. })
  327. it('should call the appropriate redis methods', function (done) {
  328. return this.call(err => {
  329. this.rclient.smembers.callCount.should.equal(1)
  330. this.rclient.del.callCount.should.equal(2)
  331. expect(this.rclient.del.firstCall.args[0]).to.deep.equal(
  332. this.sessionKeys[0]
  333. )
  334. expect(this.rclient.del.secondCall.args[0]).to.deep.equal(
  335. this.sessionKeys[1]
  336. )
  337. this.rclient.srem.callCount.should.equal(1)
  338. expect(this.rclient.srem.firstCall.args[1]).to.deep.equal(
  339. this.sessionKeys
  340. )
  341. return done()
  342. })
  343. })
  344. describe('when a session is retained', function () {
  345. beforeEach(function () {
  346. this.sessionKeys = ['sess:one', 'sess:two', 'sess:three', 'sess:four']
  347. this.retain = ['two']
  348. this.rclient.smembers.callsArgWith(1, null, this.sessionKeys)
  349. this.rclient.del = sinon.stub().callsArgWith(1, null)
  350. return (this.call = callback => {
  351. return this.UserSessionsManager.revokeAllUserSessions(
  352. this.user,
  353. this.retain,
  354. callback
  355. )
  356. })
  357. })
  358. it('should not produce an error', function (done) {
  359. return this.call(err => {
  360. expect(err).to.not.exist
  361. return done()
  362. })
  363. })
  364. it('should call the appropriate redis methods', function (done) {
  365. return this.call(err => {
  366. this.rclient.smembers.callCount.should.equal(1)
  367. this.rclient.del.callCount.should.equal(this.sessionKeys.length - 1)
  368. this.rclient.srem.callCount.should.equal(1)
  369. return done()
  370. })
  371. })
  372. it('should remove all sessions except for the retained one', function (done) {
  373. return this.call(err => {
  374. expect(this.rclient.del.firstCall.args[0]).to.deep.equal('sess:one')
  375. expect(this.rclient.del.secondCall.args[0]).to.deep.equal(
  376. 'sess:three'
  377. )
  378. expect(this.rclient.del.thirdCall.args[0]).to.deep.equal('sess:four')
  379. expect(this.rclient.srem.firstCall.args[1]).to.deep.equal([
  380. 'sess:one',
  381. 'sess:three',
  382. 'sess:four',
  383. ])
  384. return done()
  385. })
  386. })
  387. })
  388. describe('when rclient produces an error', function () {
  389. beforeEach(function () {
  390. return (this.rclient.del = sinon
  391. .stub()
  392. .callsArgWith(1, new Error('woops')))
  393. })
  394. it('should produce an error', function (done) {
  395. return this.call(err => {
  396. expect(err).to.be.instanceof(Error)
  397. return done()
  398. })
  399. })
  400. it('should not call rclient.srem', function (done) {
  401. return this.call(err => {
  402. this.rclient.srem.callCount.should.equal(0)
  403. return done()
  404. })
  405. })
  406. })
  407. describe('when no user is supplied', function () {
  408. beforeEach(function () {
  409. return (this.call = callback => {
  410. return this.UserSessionsManager.revokeAllUserSessions(
  411. null,
  412. this.retain,
  413. callback
  414. )
  415. })
  416. })
  417. it('should not produce an error', function (done) {
  418. return this.call(err => {
  419. expect(err).to.not.exist
  420. return done()
  421. })
  422. })
  423. it('should not call the appropriate redis methods', function (done) {
  424. return this.call(err => {
  425. this.rclient.smembers.callCount.should.equal(0)
  426. this.rclient.del.callCount.should.equal(0)
  427. this.rclient.srem.callCount.should.equal(0)
  428. return done()
  429. })
  430. })
  431. })
  432. describe('when there are no keys to delete', function () {
  433. beforeEach(function () {
  434. return this.rclient.smembers.callsArgWith(1, null, [])
  435. })
  436. it('should not produce an error', function (done) {
  437. return this.call(err => {
  438. expect(err).to.not.exist
  439. return done()
  440. })
  441. })
  442. it('should not do the delete operation', function (done) {
  443. return this.call(err => {
  444. this.rclient.smembers.callCount.should.equal(1)
  445. this.rclient.del.callCount.should.equal(0)
  446. this.rclient.srem.callCount.should.equal(0)
  447. return done()
  448. })
  449. })
  450. })
  451. })
  452. describe('touch', function () {
  453. beforeEach(function () {
  454. this.rclient.pexpire.callsArgWith(2, null)
  455. return (this.call = callback => {
  456. return this.UserSessionsManager.touch(this.user, callback)
  457. })
  458. })
  459. it('should not produce an error', function (done) {
  460. return this.call(err => {
  461. expect(err).to.not.exist
  462. return done()
  463. })
  464. })
  465. it('should call rclient.pexpire', function (done) {
  466. return this.call(err => {
  467. this.rclient.pexpire.callCount.should.equal(1)
  468. return done()
  469. })
  470. })
  471. describe('when rclient produces an error', function () {
  472. beforeEach(function () {
  473. return this.rclient.pexpire.callsArgWith(2, new Error('woops'))
  474. })
  475. it('should produce an error', function (done) {
  476. return this.call(err => {
  477. expect(err).to.be.instanceof(Error)
  478. return done()
  479. })
  480. })
  481. })
  482. describe('when no user is supplied', function () {
  483. beforeEach(function () {
  484. return (this.call = callback => {
  485. return this.UserSessionsManager.touch(null, callback)
  486. })
  487. })
  488. it('should not produce an error', function (done) {
  489. return this.call(err => {
  490. expect(err).to.not.exist
  491. return done()
  492. })
  493. })
  494. it('should not call pexpire', function (done) {
  495. return this.call(err => {
  496. this.rclient.pexpire.callCount.should.equal(0)
  497. return done()
  498. })
  499. })
  500. })
  501. })
  502. describe('getAllUserSessions', function () {
  503. beforeEach(function () {
  504. this.sessionKeys = ['sess:one', 'sess:two', 'sess:three']
  505. this.sessions = [
  506. '{"user": {"ip_address": "a", "session_created": "b"}}',
  507. '{"passport": {"user": {"ip_address": "c", "session_created": "d"}}}',
  508. ]
  509. this.exclude = ['two']
  510. this.rclient.smembers.callsArgWith(1, null, this.sessionKeys)
  511. this.rclient.get = sinon.stub()
  512. this.rclient.get.onCall(0).callsArgWith(1, null, this.sessions[0])
  513. this.rclient.get.onCall(1).callsArgWith(1, null, this.sessions[1])
  514. return (this.call = callback => {
  515. return this.UserSessionsManager.getAllUserSessions(
  516. this.user,
  517. this.exclude,
  518. callback
  519. )
  520. })
  521. })
  522. it('should not produce an error', function (done) {
  523. return this.call((err, sessions) => {
  524. expect(err).to.not.exist
  525. return done()
  526. })
  527. })
  528. it('should get sessions', function (done) {
  529. return this.call((err, sessions) => {
  530. expect(sessions).to.deep.equal([
  531. { ip_address: 'a', session_created: 'b' },
  532. { ip_address: 'c', session_created: 'd' },
  533. ])
  534. return done()
  535. })
  536. })
  537. it('should have called rclient.smembers', function (done) {
  538. return this.call((err, sessions) => {
  539. this.rclient.smembers.callCount.should.equal(1)
  540. return done()
  541. })
  542. })
  543. it('should have called rclient.get', function (done) {
  544. return this.call((err, sessions) => {
  545. this.rclient.get.callCount.should.equal(this.sessionKeys.length - 1)
  546. return done()
  547. })
  548. })
  549. describe('when there are no other sessions', function () {
  550. beforeEach(function () {
  551. this.sessionKeys = ['sess:two']
  552. return this.rclient.smembers.callsArgWith(1, null, this.sessionKeys)
  553. })
  554. it('should not produce an error', function (done) {
  555. return this.call((err, sessions) => {
  556. expect(err).to.not.exist
  557. return done()
  558. })
  559. })
  560. it('should produce an empty list of sessions', function (done) {
  561. return this.call((err, sessions) => {
  562. expect(sessions).to.deep.equal([])
  563. return done()
  564. })
  565. })
  566. it('should have called rclient.smembers', function (done) {
  567. return this.call((err, sessions) => {
  568. this.rclient.smembers.callCount.should.equal(1)
  569. return done()
  570. })
  571. })
  572. it('should not have called rclient.mget', function (done) {
  573. return this.call((err, sessions) => {
  574. this.rclient.mget.callCount.should.equal(0)
  575. return done()
  576. })
  577. })
  578. })
  579. describe('when smembers produces an error', function () {
  580. beforeEach(function () {
  581. return this.rclient.smembers.callsArgWith(1, new Error('woops'))
  582. })
  583. it('should produce an error', function (done) {
  584. return this.call((err, sessions) => {
  585. expect(err).to.not.equal(null)
  586. expect(err).to.be.instanceof(Error)
  587. return done()
  588. })
  589. })
  590. it('should not have called rclient.mget', function (done) {
  591. return this.call((err, sessions) => {
  592. this.rclient.mget.callCount.should.equal(0)
  593. return done()
  594. })
  595. })
  596. })
  597. describe('when get produces an error', function () {
  598. beforeEach(function () {
  599. return (this.rclient.get = sinon
  600. .stub()
  601. .callsArgWith(1, new Error('woops')))
  602. })
  603. it('should produce an error', function (done) {
  604. return this.call((err, sessions) => {
  605. expect(err).to.not.equal(null)
  606. expect(err).to.be.instanceof(Error)
  607. return done()
  608. })
  609. })
  610. })
  611. })
  612. describe('_checkSessions', function () {
  613. beforeEach(function () {
  614. this.call = callback => {
  615. return this.UserSessionsManager._checkSessions(this.user, callback)
  616. }
  617. this.sessionKeys = ['one', 'two']
  618. this.rclient.smembers.callsArgWith(1, null, this.sessionKeys)
  619. this.rclient.get.callsArgWith(1, null, 'some-value')
  620. return this.rclient.srem.callsArgWith(2, null, {})
  621. })
  622. it('should not produce an error', function (done) {
  623. return this.call(err => {
  624. expect(err).to.not.exist
  625. return done()
  626. })
  627. })
  628. it('should call the appropriate redis methods', function (done) {
  629. return this.call(err => {
  630. this.rclient.smembers.callCount.should.equal(1)
  631. this.rclient.get.callCount.should.equal(2)
  632. this.rclient.srem.callCount.should.equal(0)
  633. return done()
  634. })
  635. })
  636. describe('when one of the keys is not present in redis', function () {
  637. beforeEach(function () {
  638. this.rclient.get.onCall(0).callsArgWith(1, null, 'some-val')
  639. return this.rclient.get.onCall(1).callsArgWith(1, null, null)
  640. })
  641. it('should not produce an error', function (done) {
  642. return this.call(err => {
  643. expect(err).to.not.exist
  644. return done()
  645. })
  646. })
  647. it('should remove that key from the set', function (done) {
  648. return this.call(err => {
  649. this.rclient.smembers.callCount.should.equal(1)
  650. this.rclient.get.callCount.should.equal(2)
  651. this.rclient.srem.callCount.should.equal(1)
  652. this.rclient.srem.firstCall.args[1].should.equal('two')
  653. return done()
  654. })
  655. })
  656. })
  657. describe('when no user is supplied', function () {
  658. beforeEach(function () {
  659. return (this.call = callback => {
  660. return this.UserSessionsManager._checkSessions(null, callback)
  661. })
  662. })
  663. it('should not produce an error', function (done) {
  664. return this.call(err => {
  665. expect(err).to.not.exist
  666. return done()
  667. })
  668. })
  669. it('should not call redis methods', function (done) {
  670. return this.call(err => {
  671. this.rclient.smembers.callCount.should.equal(0)
  672. this.rclient.get.callCount.should.equal(0)
  673. return done()
  674. })
  675. })
  676. })
  677. describe('when one of the get operations produces an error', function () {
  678. beforeEach(function () {
  679. this.rclient.get.onCall(0).callsArgWith(1, new Error('woops'), null)
  680. return this.rclient.get.onCall(1).callsArgWith(1, null, null)
  681. })
  682. it('should produce an error', function (done) {
  683. return this.call(err => {
  684. expect(err).to.be.instanceof(Error)
  685. return done()
  686. })
  687. })
  688. it('should call the right redis methods, bailing out early', function (done) {
  689. return this.call(err => {
  690. this.rclient.smembers.callCount.should.equal(1)
  691. this.rclient.get.callCount.should.equal(1)
  692. this.rclient.srem.callCount.should.equal(0)
  693. return done()
  694. })
  695. })
  696. })
  697. })
  698. })