Explorar el Código

Merge pull request #2648 from overleaf/msm-fix-multiresult-promisify

Added multiResult to ProjectEntityHandler.promises.getDoc

GitOrigin-RevId: 6a2807cdae822c188298b48887d0eff57edf12d4
Timothée Alby hace 6 años
padre
commit
403704710c
Se han modificado 1 ficheros con 32 adiciones y 0 borrados
  1. 32 0
      services/web/test/unit/src/Project/ProjectEntityHandlerTests.js

+ 32 - 0
services/web/test/unit/src/Project/ProjectEntityHandlerTests.js

@@ -331,4 +331,36 @@ describe('ProjectEntityHandler', function() {
         .should.equal(true)
     })
   })
+
+  describe('promises.getDoc', function() {
+    let result
+
+    beforeEach(async function() {
+      this.lines = ['mock', 'doc', 'lines']
+      this.rev = 5
+      this.version = 42
+      this.ranges = { mock: 'ranges' }
+
+      this.DocstoreManager.getDoc = sinon
+        .stub()
+        .callsArgWith(3, null, this.lines, this.rev, this.version, this.ranges)
+      result = await this.ProjectEntityHandler.promises.getDoc(
+        project_id,
+        doc_id
+      )
+    })
+
+    it('should call the docstore', function() {
+      this.DocstoreManager.getDoc
+        .calledWith(project_id, doc_id)
+        .should.equal(true)
+    })
+
+    it('should return the lines, rev, version and ranges', function() {
+      expect(result.lines).to.equal(this.lines)
+      expect(result.rev).to.equal(this.rev)
+      expect(result.version).to.equal(this.version)
+      expect(result.ranges).to.equal(this.ranges)
+    })
+  })
 })