2020-05-06 06:12:36 -04:00
|
|
|
/* eslint-disable
|
|
|
|
camelcase,
|
|
|
|
*/
|
2020-05-06 06:12:47 -04:00
|
|
|
const sinon = require('sinon')
|
|
|
|
const chai = require('chai')
|
|
|
|
chai.should()
|
|
|
|
const { expect } = require('chai')
|
|
|
|
const Settings = require('settings-sharelatex')
|
|
|
|
const rclient_du = require('redis-sharelatex').createClient(
|
|
|
|
Settings.redis.documentupdater
|
|
|
|
)
|
|
|
|
const Keys = Settings.redis.documentupdater.key_schema
|
|
|
|
|
|
|
|
const MockTrackChangesApi = require('./helpers/MockTrackChangesApi')
|
|
|
|
const MockProjectHistoryApi = require('./helpers/MockProjectHistoryApi')
|
|
|
|
const MockWebApi = require('./helpers/MockWebApi')
|
|
|
|
const DocUpdaterClient = require('./helpers/DocUpdaterClient')
|
|
|
|
const DocUpdaterApp = require('./helpers/DocUpdaterApp')
|
|
|
|
|
|
|
|
describe('Setting a document', function () {
|
|
|
|
before(function (done) {
|
|
|
|
this.lines = ['one', 'two', 'three']
|
|
|
|
this.version = 42
|
|
|
|
this.update = {
|
|
|
|
doc: this.doc_id,
|
|
|
|
op: [
|
|
|
|
{
|
|
|
|
i: 'one and a half\n',
|
|
|
|
p: 4
|
|
|
|
}
|
|
|
|
],
|
|
|
|
v: this.version
|
|
|
|
}
|
|
|
|
this.result = ['one', 'one and a half', 'two', 'three']
|
|
|
|
this.newLines = ['these', 'are', 'the', 'new', 'lines']
|
|
|
|
this.source = 'dropbox'
|
|
|
|
this.user_id = 'user-id-123'
|
|
|
|
|
|
|
|
sinon.spy(MockTrackChangesApi, 'flushDoc')
|
|
|
|
sinon.spy(MockProjectHistoryApi, 'flushProject')
|
|
|
|
sinon.spy(MockWebApi, 'setDocument')
|
2020-05-08 12:03:54 -04:00
|
|
|
DocUpdaterApp.ensureRunning(done)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
|
|
MockTrackChangesApi.flushDoc.restore()
|
|
|
|
MockProjectHistoryApi.flushProject.restore()
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument.restore()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
describe('when the updated doc exists in the doc updater', function () {
|
|
|
|
before(function (done) {
|
2020-05-08 12:01:25 -04:00
|
|
|
this.project_id = DocUpdaterClient.randomId()
|
|
|
|
this.doc_id = DocUpdaterClient.randomId()
|
2020-05-06 06:12:47 -04:00
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
|
lines: this.lines,
|
|
|
|
version: this.version
|
|
|
|
})
|
|
|
|
DocUpdaterClient.preloadDoc(this.project_id, this.doc_id, (error) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
2020-05-08 12:03:54 -04:00
|
|
|
DocUpdaterClient.sendUpdate(
|
2020-05-06 06:12:47 -04:00
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.update,
|
|
|
|
(error) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
2020-05-08 12:03:54 -04:00
|
|
|
setTimeout(() => {
|
|
|
|
DocUpdaterClient.setDocLines(
|
2020-05-06 06:12:47 -04:00
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.newLines,
|
|
|
|
this.source,
|
|
|
|
this.user_id,
|
|
|
|
false,
|
|
|
|
(error, res, body) => {
|
2020-05-08 14:08:31 -04:00
|
|
|
if (error) {
|
|
|
|
return done(error)
|
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
this.statusCode = res.statusCode
|
2020-05-08 12:03:54 -04:00
|
|
|
done()
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}, 200)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
|
|
MockTrackChangesApi.flushDoc.reset()
|
|
|
|
MockProjectHistoryApi.flushProject.reset()
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument.reset()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should return a 204 status code', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
this.statusCode.should.equal(204)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should send the updated doc lines and version to the web api', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument
|
2020-05-06 06:12:47 -04:00
|
|
|
.calledWith(this.project_id, this.doc_id, this.newLines)
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should update the lines in the doc updater', function (done) {
|
|
|
|
DocUpdaterClient.getDoc(
|
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
(error, res, doc) => {
|
2020-05-08 14:08:31 -04:00
|
|
|
if (error) {
|
|
|
|
return done(error)
|
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
doc.lines.should.deep.equal(this.newLines)
|
2020-05-08 12:03:54 -04:00
|
|
|
done()
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should bump the version in the doc updater', function (done) {
|
|
|
|
DocUpdaterClient.getDoc(
|
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
(error, res, doc) => {
|
2020-05-08 14:08:31 -04:00
|
|
|
if (error) {
|
|
|
|
return done(error)
|
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
doc.version.should.equal(this.version + 2)
|
2020-05-08 12:03:54 -04:00
|
|
|
done()
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2020-05-08 12:03:54 -04:00
|
|
|
it('should leave the document in redis', function (done) {
|
2020-05-06 06:12:47 -04:00
|
|
|
rclient_du.get(Keys.docLines({ doc_id: this.doc_id }), (error, lines) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
|
|
|
expect(JSON.parse(lines)).to.deep.equal(this.newLines)
|
2020-05-08 12:03:54 -04:00
|
|
|
done()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('when the updated doc does not exist in the doc updater', function () {
|
|
|
|
before(function (done) {
|
2020-05-08 12:01:25 -04:00
|
|
|
this.project_id = DocUpdaterClient.randomId()
|
|
|
|
this.doc_id = DocUpdaterClient.randomId()
|
2020-05-06 06:12:47 -04:00
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
|
lines: this.lines,
|
|
|
|
version: this.version
|
|
|
|
})
|
|
|
|
DocUpdaterClient.setDocLines(
|
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.newLines,
|
|
|
|
this.source,
|
|
|
|
this.user_id,
|
|
|
|
false,
|
|
|
|
(error, res, body) => {
|
2020-05-08 14:08:31 -04:00
|
|
|
if (error) {
|
|
|
|
return done(error)
|
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
this.statusCode = res.statusCode
|
2020-05-08 12:03:54 -04:00
|
|
|
setTimeout(done, 200)
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
|
|
MockTrackChangesApi.flushDoc.reset()
|
|
|
|
MockProjectHistoryApi.flushProject.reset()
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument.reset()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should return a 204 status code', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
this.statusCode.should.equal(204)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should send the updated doc lines to the web api', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument
|
2020-05-06 06:12:47 -04:00
|
|
|
.calledWith(this.project_id, this.doc_id, this.newLines)
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should flush track changes', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
MockTrackChangesApi.flushDoc.calledWith(this.doc_id).should.equal(true)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should flush project history', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
MockProjectHistoryApi.flushProject
|
2020-05-06 06:12:47 -04:00
|
|
|
.calledWith(this.project_id)
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
|
2020-05-08 12:03:54 -04:00
|
|
|
it('should remove the document from redis', function (done) {
|
2020-05-06 06:12:47 -04:00
|
|
|
rclient_du.get(Keys.docLines({ doc_id: this.doc_id }), (error, lines) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
|
|
|
expect(lines).to.not.exist
|
2020-05-08 12:03:54 -04:00
|
|
|
done()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('when the updated doc is too large for the body parser', function () {
|
|
|
|
before(function (done) {
|
2020-05-08 12:01:25 -04:00
|
|
|
this.project_id = DocUpdaterClient.randomId()
|
|
|
|
this.doc_id = DocUpdaterClient.randomId()
|
2020-05-06 06:12:47 -04:00
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
|
lines: this.lines,
|
|
|
|
version: this.version
|
|
|
|
})
|
|
|
|
this.newLines = []
|
|
|
|
while (
|
2020-05-08 11:53:02 -04:00
|
|
|
JSON.stringify(this.newLines).length <= Settings.maxJsonRequestSize
|
2020-05-06 06:12:47 -04:00
|
|
|
) {
|
|
|
|
this.newLines.push('(a long line of text)'.repeat(10000))
|
|
|
|
}
|
|
|
|
DocUpdaterClient.setDocLines(
|
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.newLines,
|
|
|
|
this.source,
|
|
|
|
this.user_id,
|
|
|
|
false,
|
|
|
|
(error, res, body) => {
|
2020-05-08 14:08:31 -04:00
|
|
|
if (error) {
|
|
|
|
return done(error)
|
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
this.statusCode = res.statusCode
|
2020-05-08 12:03:54 -04:00
|
|
|
setTimeout(done, 200)
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
|
|
MockTrackChangesApi.flushDoc.reset()
|
|
|
|
MockProjectHistoryApi.flushProject.reset()
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument.reset()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should return a 413 status code', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
this.statusCode.should.equal(413)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should not send the updated doc lines to the web api', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument.called.should.equal(false)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should not flush track changes', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
MockTrackChangesApi.flushDoc.called.should.equal(false)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
2020-05-08 12:03:54 -04:00
|
|
|
it('should not flush project history', function () {
|
|
|
|
MockProjectHistoryApi.flushProject.called.should.equal(false)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('when the updated doc is large but under the bodyParser and HTTPController size limit', function () {
|
|
|
|
before(function (done) {
|
2020-05-08 12:01:25 -04:00
|
|
|
this.project_id = DocUpdaterClient.randomId()
|
|
|
|
this.doc_id = DocUpdaterClient.randomId()
|
2020-05-06 06:12:47 -04:00
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
|
lines: this.lines,
|
|
|
|
version: this.version
|
|
|
|
})
|
|
|
|
|
|
|
|
this.newLines = []
|
|
|
|
while (JSON.stringify(this.newLines).length < 2 * 1024 * 1024) {
|
|
|
|
// limit in HTTPController
|
|
|
|
this.newLines.push('(a long line of text)'.repeat(10000))
|
|
|
|
}
|
|
|
|
this.newLines.pop() // remove the line which took it over the limit
|
|
|
|
DocUpdaterClient.setDocLines(
|
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.newLines,
|
|
|
|
this.source,
|
|
|
|
this.user_id,
|
|
|
|
false,
|
|
|
|
(error, res, body) => {
|
2020-05-08 14:08:31 -04:00
|
|
|
if (error) {
|
|
|
|
return done(error)
|
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
this.statusCode = res.statusCode
|
2020-05-08 12:03:54 -04:00
|
|
|
setTimeout(done, 200)
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
|
|
MockTrackChangesApi.flushDoc.reset()
|
|
|
|
MockProjectHistoryApi.flushProject.reset()
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument.reset()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
it('should return a 204 status code', function () {
|
2020-05-08 12:03:54 -04:00
|
|
|
this.statusCode.should.equal(204)
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
2020-05-08 12:03:54 -04:00
|
|
|
it('should send the updated doc lines to the web api', function () {
|
|
|
|
MockWebApi.setDocument
|
2020-05-06 06:12:47 -04:00
|
|
|
.calledWith(this.project_id, this.doc_id, this.newLines)
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-05-08 12:03:54 -04:00
|
|
|
describe('with track changes', function () {
|
2020-05-06 06:12:47 -04:00
|
|
|
before(function () {
|
|
|
|
this.lines = ['one', 'one and a half', 'two', 'three']
|
|
|
|
this.id_seed = '587357bd35e64f6157'
|
2020-05-08 12:03:54 -04:00
|
|
|
this.update = {
|
2020-05-06 06:12:47 -04:00
|
|
|
doc: this.doc_id,
|
|
|
|
op: [
|
|
|
|
{
|
|
|
|
d: 'one and a half\n',
|
|
|
|
p: 4
|
|
|
|
}
|
|
|
|
],
|
|
|
|
meta: {
|
|
|
|
tc: this.id_seed,
|
|
|
|
user_id: this.user_id
|
|
|
|
},
|
|
|
|
v: this.version
|
2020-05-08 12:03:54 -04:00
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
describe('with the undo flag', function () {
|
|
|
|
before(function (done) {
|
2020-05-08 12:01:25 -04:00
|
|
|
this.project_id = DocUpdaterClient.randomId()
|
|
|
|
this.doc_id = DocUpdaterClient.randomId()
|
2020-05-06 06:12:47 -04:00
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
|
lines: this.lines,
|
|
|
|
version: this.version
|
|
|
|
})
|
|
|
|
DocUpdaterClient.preloadDoc(this.project_id, this.doc_id, (error) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
2020-05-08 12:03:54 -04:00
|
|
|
DocUpdaterClient.sendUpdate(
|
2020-05-06 06:12:47 -04:00
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.update,
|
|
|
|
(error) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
|
|
|
// Go back to old lines, with undo flag
|
2020-05-08 12:03:54 -04:00
|
|
|
DocUpdaterClient.setDocLines(
|
2020-05-06 06:12:47 -04:00
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.lines,
|
|
|
|
this.source,
|
|
|
|
this.user_id,
|
|
|
|
true,
|
|
|
|
(error, res, body) => {
|
2020-05-08 14:08:31 -04:00
|
|
|
if (error) {
|
|
|
|
return done(error)
|
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
this.statusCode = res.statusCode
|
2020-05-08 12:03:54 -04:00
|
|
|
setTimeout(done, 200)
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
|
|
MockTrackChangesApi.flushDoc.reset()
|
|
|
|
MockProjectHistoryApi.flushProject.reset()
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument.reset()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
2020-05-08 12:03:54 -04:00
|
|
|
it('should undo the tracked changes', function (done) {
|
2020-05-06 06:12:47 -04:00
|
|
|
DocUpdaterClient.getDoc(
|
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
(error, res, data) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
|
|
|
const { ranges } = data
|
|
|
|
expect(ranges.changes).to.be.undefined
|
2020-05-08 12:03:54 -04:00
|
|
|
done()
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-05-08 12:03:54 -04:00
|
|
|
describe('without the undo flag', function () {
|
2020-05-06 06:12:47 -04:00
|
|
|
before(function (done) {
|
2020-05-08 12:01:25 -04:00
|
|
|
this.project_id = DocUpdaterClient.randomId()
|
|
|
|
this.doc_id = DocUpdaterClient.randomId()
|
2020-05-06 06:12:47 -04:00
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
|
lines: this.lines,
|
|
|
|
version: this.version
|
|
|
|
})
|
|
|
|
DocUpdaterClient.preloadDoc(this.project_id, this.doc_id, (error) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
2020-05-08 12:03:54 -04:00
|
|
|
DocUpdaterClient.sendUpdate(
|
2020-05-06 06:12:47 -04:00
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.update,
|
|
|
|
(error) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
|
|
|
// Go back to old lines, without undo flag
|
2020-05-08 12:03:54 -04:00
|
|
|
DocUpdaterClient.setDocLines(
|
2020-05-06 06:12:47 -04:00
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
this.lines,
|
|
|
|
this.source,
|
|
|
|
this.user_id,
|
|
|
|
false,
|
|
|
|
(error, res, body) => {
|
2020-05-08 14:08:31 -04:00
|
|
|
if (error) {
|
|
|
|
return done(error)
|
|
|
|
}
|
2020-05-06 06:12:47 -04:00
|
|
|
this.statusCode = res.statusCode
|
2020-05-08 12:03:54 -04:00
|
|
|
setTimeout(done, 200)
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
after(function () {
|
|
|
|
MockTrackChangesApi.flushDoc.reset()
|
|
|
|
MockProjectHistoryApi.flushProject.reset()
|
2020-05-08 12:03:54 -04:00
|
|
|
MockWebApi.setDocument.reset()
|
2020-05-06 06:12:47 -04:00
|
|
|
})
|
|
|
|
|
2020-05-08 12:03:54 -04:00
|
|
|
it('should not undo the tracked changes', function (done) {
|
2020-05-06 06:12:47 -04:00
|
|
|
DocUpdaterClient.getDoc(
|
|
|
|
this.project_id,
|
|
|
|
this.doc_id,
|
|
|
|
(error, res, data) => {
|
2020-05-08 14:06:25 -04:00
|
|
|
if (error) {
|
2020-05-06 06:12:47 -04:00
|
|
|
throw error
|
|
|
|
}
|
|
|
|
const { ranges } = data
|
|
|
|
expect(ranges.changes.length).to.equal(1)
|
2020-05-08 12:03:54 -04:00
|
|
|
done()
|
2020-05-06 06:12:47 -04:00
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|