|
@@ -42,10 +42,10 @@ describe('Applying updates to a doc', function () {
|
|
|
op: [
|
|
op: [
|
|
|
{
|
|
{
|
|
|
i: 'one and a half\n',
|
|
i: 'one and a half\n',
|
|
|
- p: 4
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ p: 4,
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
- v: this.version
|
|
|
|
|
|
|
+ v: this.version,
|
|
|
}
|
|
}
|
|
|
this.result = ['one', 'one and a half', 'two', 'three']
|
|
this.result = ['one', 'one and a half', 'two', 'three']
|
|
|
return DocUpdaterApp.ensureRunning(done)
|
|
return DocUpdaterApp.ensureRunning(done)
|
|
@@ -55,19 +55,19 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
sinon.spy(MockWebApi, 'getDocument')
|
|
sinon.spy(MockWebApi, 'getDocument')
|
|
|
this.startTime = Date.now()
|
|
this.startTime = Date.now()
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
lines: this.lines,
|
|
lines: this.lines,
|
|
|
- version: this.version
|
|
|
|
|
|
|
+ version: this.version,
|
|
|
})
|
|
})
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.update,
|
|
this.update,
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -144,7 +144,7 @@ describe('Applying updates to a doc', function () {
|
|
|
it('should set the first op timestamp', function (done) {
|
|
it('should set the first op timestamp', function (done) {
|
|
|
rclient_project_history.get(
|
|
rclient_project_history.get(
|
|
|
ProjectHistoryKeys.projectHistoryFirstOpTimestamp({
|
|
ProjectHistoryKeys.projectHistoryFirstOpTimestamp({
|
|
|
- project_id: this.project_id
|
|
|
|
|
|
|
+ project_id: this.project_id,
|
|
|
}),
|
|
}),
|
|
|
(error, result) => {
|
|
(error, result) => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
@@ -167,7 +167,7 @@ describe('Applying updates to a doc', function () {
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.second_update,
|
|
this.second_update,
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -180,7 +180,7 @@ describe('Applying updates to a doc', function () {
|
|
|
return it('should not change the first op timestamp', function (done) {
|
|
return it('should not change the first op timestamp', function (done) {
|
|
|
rclient_project_history.get(
|
|
rclient_project_history.get(
|
|
|
ProjectHistoryKeys.projectHistoryFirstOpTimestamp({
|
|
ProjectHistoryKeys.projectHistoryFirstOpTimestamp({
|
|
|
- project_id: this.project_id
|
|
|
|
|
|
|
+ project_id: this.project_id,
|
|
|
}),
|
|
}),
|
|
|
(error, result) => {
|
|
(error, result) => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
@@ -199,14 +199,14 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
lines: this.lines,
|
|
lines: this.lines,
|
|
|
- version: this.version
|
|
|
|
|
|
|
+ version: this.version,
|
|
|
})
|
|
})
|
|
|
- DocUpdaterClient.preloadDoc(this.project_id, this.doc_id, (error) => {
|
|
|
|
|
|
|
+ DocUpdaterClient.preloadDoc(this.project_id, this.doc_id, error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -215,7 +215,7 @@ describe('Applying updates to a doc', function () {
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.update,
|
|
this.update,
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -284,15 +284,15 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
lines: this.lines,
|
|
lines: this.lines,
|
|
|
version: this.version,
|
|
version: this.version,
|
|
|
- projectHistoryType: 'project-history'
|
|
|
|
|
|
|
+ projectHistoryType: 'project-history',
|
|
|
})
|
|
})
|
|
|
- DocUpdaterClient.preloadDoc(this.project_id, this.doc_id, (error) => {
|
|
|
|
|
|
|
+ DocUpdaterClient.preloadDoc(this.project_id, this.doc_id, error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -301,7 +301,7 @@ describe('Applying updates to a doc', function () {
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.update,
|
|
this.update,
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -360,12 +360,12 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
const lines = ['', '', '']
|
|
const lines = ['', '', '']
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
lines,
|
|
lines,
|
|
|
- version: 0
|
|
|
|
|
|
|
+ version: 0,
|
|
|
})
|
|
})
|
|
|
this.updates = [
|
|
this.updates = [
|
|
|
{ doc_id: this.doc_id, v: 0, op: [{ i: 'h', p: 0 }] },
|
|
{ doc_id: this.doc_id, v: 0, op: [{ i: 'h', p: 0 }] },
|
|
@@ -378,7 +378,7 @@ describe('Applying updates to a doc', function () {
|
|
|
{ doc_id: this.doc_id, v: 7, op: [{ i: 'o', p: 7 }] },
|
|
{ doc_id: this.doc_id, v: 7, op: [{ i: 'o', p: 7 }] },
|
|
|
{ doc_id: this.doc_id, v: 8, op: [{ i: 'r', p: 8 }] },
|
|
{ doc_id: this.doc_id, v: 8, op: [{ i: 'r', p: 8 }] },
|
|
|
{ doc_id: this.doc_id, v: 9, op: [{ i: 'l', p: 9 }] },
|
|
{ doc_id: this.doc_id, v: 9, op: [{ i: 'l', p: 9 }] },
|
|
|
- { doc_id: this.doc_id, v: 10, op: [{ i: 'd', p: 10 }] }
|
|
|
|
|
|
|
+ { doc_id: this.doc_id, v: 10, op: [{ i: 'd', p: 10 }] },
|
|
|
]
|
|
]
|
|
|
this.my_result = ['hello world', '', '']
|
|
this.my_result = ['hello world', '', '']
|
|
|
return done()
|
|
return done()
|
|
@@ -388,8 +388,8 @@ describe('Applying updates to a doc', function () {
|
|
|
let update
|
|
let update
|
|
|
const actions = []
|
|
const actions = []
|
|
|
for (update of Array.from(this.updates.slice(0, 6))) {
|
|
for (update of Array.from(this.updates.slice(0, 6))) {
|
|
|
- ;((update) => {
|
|
|
|
|
- return actions.push((callback) =>
|
|
|
|
|
|
|
+ ;(update => {
|
|
|
|
|
+ return actions.push(callback =>
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
@@ -399,12 +399,12 @@ describe('Applying updates to a doc', function () {
|
|
|
)
|
|
)
|
|
|
})(update)
|
|
})(update)
|
|
|
}
|
|
}
|
|
|
- actions.push((callback) =>
|
|
|
|
|
|
|
+ actions.push(callback =>
|
|
|
DocUpdaterClient.deleteDoc(this.project_id, this.doc_id, callback)
|
|
DocUpdaterClient.deleteDoc(this.project_id, this.doc_id, callback)
|
|
|
)
|
|
)
|
|
|
for (update of Array.from(this.updates.slice(6))) {
|
|
for (update of Array.from(this.updates.slice(6))) {
|
|
|
- ;((update) => {
|
|
|
|
|
- return actions.push((callback) =>
|
|
|
|
|
|
|
+ ;(update => {
|
|
|
|
|
+ return actions.push(callback =>
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
@@ -415,7 +415,7 @@ describe('Applying updates to a doc', function () {
|
|
|
})(update)
|
|
})(update)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async.series(actions, (error) => {
|
|
|
|
|
|
|
+ async.series(actions, error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -437,7 +437,7 @@ describe('Applying updates to a doc', function () {
|
|
|
0,
|
|
0,
|
|
|
-1,
|
|
-1,
|
|
|
(error, updates) => {
|
|
(error, updates) => {
|
|
|
- updates = Array.from(updates).map((u) => JSON.parse(u))
|
|
|
|
|
|
|
+ updates = Array.from(updates).map(u => JSON.parse(u))
|
|
|
for (let i = 0; i < this.updates.length; i++) {
|
|
for (let i = 0; i < this.updates.length; i++) {
|
|
|
const appliedUpdate = this.updates[i]
|
|
const appliedUpdate = this.updates[i]
|
|
|
appliedUpdate.op.should.deep.equal(updates[i].op)
|
|
appliedUpdate.op.should.deep.equal(updates[i].op)
|
|
@@ -462,7 +462,7 @@ describe('Applying updates to a doc', function () {
|
|
|
0,
|
|
0,
|
|
|
-1,
|
|
-1,
|
|
|
(error, updates) => {
|
|
(error, updates) => {
|
|
|
- updates = Array.from(updates).map((u) => JSON.parse(u))
|
|
|
|
|
|
|
+ updates = Array.from(updates).map(u => JSON.parse(u))
|
|
|
for (let i = 0; i < this.updates.length; i++) {
|
|
for (let i = 0; i < this.updates.length; i++) {
|
|
|
const appliedUpdate = this.updates[i]
|
|
const appliedUpdate = this.updates[i]
|
|
|
appliedUpdate.op.should.deep.equal(updates[i].op)
|
|
appliedUpdate.op.should.deep.equal(updates[i].op)
|
|
@@ -478,12 +478,12 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
const lines = ['', '', '']
|
|
const lines = ['', '', '']
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
lines,
|
|
lines,
|
|
|
- version: 0
|
|
|
|
|
|
|
+ version: 0,
|
|
|
})
|
|
})
|
|
|
this.updates = [
|
|
this.updates = [
|
|
|
{ doc_id: this.doc_id, v: 0, op: [{ i: 'h', p: 0 }] },
|
|
{ doc_id: this.doc_id, v: 0, op: [{ i: 'h', p: 0 }] },
|
|
@@ -491,7 +491,7 @@ describe('Applying updates to a doc', function () {
|
|
|
{ doc_id: this.doc_id, v: 2, op: [{ i: 'l', p: 2 }] },
|
|
{ doc_id: this.doc_id, v: 2, op: [{ i: 'l', p: 2 }] },
|
|
|
{ doc_id: this.doc_id, v: 3, op: [{ i: 'l', p: 3 }] },
|
|
{ doc_id: this.doc_id, v: 3, op: [{ i: 'l', p: 3 }] },
|
|
|
{ doc_id: this.doc_id, v: 4, op: [{ i: 'o', p: 4 }] },
|
|
{ doc_id: this.doc_id, v: 4, op: [{ i: 'o', p: 4 }] },
|
|
|
- { doc_id: this.doc_id, v: 0, op: [{ i: 'world', p: 1 }] }
|
|
|
|
|
|
|
+ { doc_id: this.doc_id, v: 0, op: [{ i: 'world', p: 1 }] },
|
|
|
]
|
|
]
|
|
|
this.my_result = ['hello', 'world', '']
|
|
this.my_result = ['hello', 'world', '']
|
|
|
return done()
|
|
return done()
|
|
@@ -501,8 +501,8 @@ describe('Applying updates to a doc', function () {
|
|
|
let update
|
|
let update
|
|
|
const actions = []
|
|
const actions = []
|
|
|
for (update of Array.from(this.updates.slice(0, 5))) {
|
|
for (update of Array.from(this.updates.slice(0, 5))) {
|
|
|
- ;((update) => {
|
|
|
|
|
- return actions.push((callback) =>
|
|
|
|
|
|
|
+ ;(update => {
|
|
|
|
|
+ return actions.push(callback =>
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
@@ -512,12 +512,12 @@ describe('Applying updates to a doc', function () {
|
|
|
)
|
|
)
|
|
|
})(update)
|
|
})(update)
|
|
|
}
|
|
}
|
|
|
- actions.push((callback) =>
|
|
|
|
|
|
|
+ actions.push(callback =>
|
|
|
DocUpdaterClient.deleteDoc(this.project_id, this.doc_id, callback)
|
|
DocUpdaterClient.deleteDoc(this.project_id, this.doc_id, callback)
|
|
|
)
|
|
)
|
|
|
for (update of Array.from(this.updates.slice(5))) {
|
|
for (update of Array.from(this.updates.slice(5))) {
|
|
|
- ;((update) => {
|
|
|
|
|
- return actions.push((callback) =>
|
|
|
|
|
|
|
+ ;(update => {
|
|
|
|
|
+ return actions.push(callback =>
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
@@ -528,7 +528,7 @@ describe('Applying updates to a doc', function () {
|
|
|
})(update)
|
|
})(update)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async.series(actions, (error) => {
|
|
|
|
|
|
|
+ async.series(actions, error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -550,16 +550,16 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
this.broken_update = {
|
|
this.broken_update = {
|
|
|
doc_id: this.doc_id,
|
|
doc_id: this.doc_id,
|
|
|
v: this.version,
|
|
v: this.version,
|
|
|
- op: [{ d: 'not the correct content', p: 0 }]
|
|
|
|
|
|
|
+ op: [{ d: 'not the correct content', p: 0 }],
|
|
|
}
|
|
}
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
lines: this.lines,
|
|
lines: this.lines,
|
|
|
- version: this.version
|
|
|
|
|
|
|
+ version: this.version,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
DocUpdaterClient.subscribeToAppliedOps(
|
|
DocUpdaterClient.subscribeToAppliedOps(
|
|
@@ -570,7 +570,7 @@ describe('Applying updates to a doc', function () {
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.broken_update,
|
|
this.broken_update,
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -599,7 +599,7 @@ describe('Applying updates to a doc', function () {
|
|
|
return JSON.parse(message).should.deep.include({
|
|
return JSON.parse(message).should.deep.include({
|
|
|
project_id: this.project_id,
|
|
project_id: this.project_id,
|
|
|
doc_id: this.doc_id,
|
|
doc_id: this.doc_id,
|
|
|
- error: 'Delete component does not match'
|
|
|
|
|
|
|
+ error: 'Delete component does not match',
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
@@ -608,7 +608,7 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
const updates = []
|
|
const updates = []
|
|
|
for (let v = 0; v <= 199; v++) {
|
|
for (let v = 0; v <= 199; v++) {
|
|
@@ -616,7 +616,7 @@ describe('Applying updates to a doc', function () {
|
|
|
updates.push({
|
|
updates.push({
|
|
|
doc_id: this.doc_id,
|
|
doc_id: this.doc_id,
|
|
|
op: [{ i: v.toString(), p: 0 }],
|
|
op: [{ i: v.toString(), p: 0 }],
|
|
|
- v
|
|
|
|
|
|
|
+ v,
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -624,14 +624,14 @@ describe('Applying updates to a doc', function () {
|
|
|
|
|
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
lines: this.lines,
|
|
lines: this.lines,
|
|
|
- version: 0
|
|
|
|
|
|
|
+ version: 0,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// Send updates in chunks to causes multiple flushes
|
|
// Send updates in chunks to causes multiple flushes
|
|
|
const actions = []
|
|
const actions = []
|
|
|
for (let i = 0; i <= 19; i++) {
|
|
for (let i = 0; i <= 19; i++) {
|
|
|
- ;((i) => {
|
|
|
|
|
- return actions.push((cb) => {
|
|
|
|
|
|
|
+ ;(i => {
|
|
|
|
|
+ return actions.push(cb => {
|
|
|
return DocUpdaterClient.sendUpdates(
|
|
return DocUpdaterClient.sendUpdates(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
@@ -641,7 +641,7 @@ describe('Applying updates to a doc', function () {
|
|
|
})
|
|
})
|
|
|
})(i)
|
|
})(i)
|
|
|
}
|
|
}
|
|
|
- async.series(actions, (error) => {
|
|
|
|
|
|
|
+ async.series(actions, error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -663,22 +663,22 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
- lines: this.lines
|
|
|
|
|
|
|
+ lines: this.lines,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const update = {
|
|
const update = {
|
|
|
doc: this.doc_id,
|
|
doc: this.doc_id,
|
|
|
op: this.update.op,
|
|
op: this.update.op,
|
|
|
- v: 0
|
|
|
|
|
|
|
+ v: 0,
|
|
|
}
|
|
}
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
update,
|
|
update,
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -705,11 +705,11 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
MockWebApi.insertDoc(this.project_id, this.doc_id, {
|
|
|
lines: this.lines,
|
|
lines: this.lines,
|
|
|
- version: this.version
|
|
|
|
|
|
|
+ version: this.version,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
DocUpdaterClient.subscribeToAppliedOps(
|
|
DocUpdaterClient.subscribeToAppliedOps(
|
|
@@ -725,15 +725,15 @@ describe('Applying updates to a doc', function () {
|
|
|
op: [
|
|
op: [
|
|
|
{
|
|
{
|
|
|
i: 'one and a half\n',
|
|
i: 'one and a half\n',
|
|
|
- p: 4
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ p: 4,
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
v: this.version,
|
|
v: this.version,
|
|
|
meta: {
|
|
meta: {
|
|
|
- source: 'ikHceq3yfAdQYzBo4-xZ'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ source: 'ikHceq3yfAdQYzBo4-xZ',
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -746,16 +746,16 @@ describe('Applying updates to a doc', function () {
|
|
|
op: [
|
|
op: [
|
|
|
{
|
|
{
|
|
|
i: 'one and a half\n',
|
|
i: 'one and a half\n',
|
|
|
- p: 4
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ p: 4,
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
v: this.version,
|
|
v: this.version,
|
|
|
dupIfSource: ['ikHceq3yfAdQYzBo4-xZ'],
|
|
dupIfSource: ['ikHceq3yfAdQYzBo4-xZ'],
|
|
|
meta: {
|
|
meta: {
|
|
|
- source: 'ikHceq3yfAdQYzBo4-xZ'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ source: 'ikHceq3yfAdQYzBo4-xZ',
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -795,12 +795,12 @@ describe('Applying updates to a doc', function () {
|
|
|
before(function (done) {
|
|
before(function (done) {
|
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
;[this.project_id, this.doc_id] = Array.from([
|
|
|
DocUpdaterClient.randomId(),
|
|
DocUpdaterClient.randomId(),
|
|
|
- DocUpdaterClient.randomId()
|
|
|
|
|
|
|
+ DocUpdaterClient.randomId(),
|
|
|
])
|
|
])
|
|
|
this.non_existing = {
|
|
this.non_existing = {
|
|
|
doc_id: this.doc_id,
|
|
doc_id: this.doc_id,
|
|
|
v: this.version,
|
|
v: this.version,
|
|
|
- op: [{ d: 'content', p: 0 }]
|
|
|
|
|
|
|
+ op: [{ d: 'content', p: 0 }],
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
DocUpdaterClient.subscribeToAppliedOps(
|
|
DocUpdaterClient.subscribeToAppliedOps(
|
|
@@ -811,7 +811,7 @@ describe('Applying updates to a doc', function () {
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.non_existing,
|
|
this.non_existing,
|
|
|
- (error) => {
|
|
|
|
|
|
|
+ error => {
|
|
|
if (error != null) {
|
|
if (error != null) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
@@ -840,7 +840,7 @@ describe('Applying updates to a doc', function () {
|
|
|
return JSON.parse(message).should.deep.include({
|
|
return JSON.parse(message).should.deep.include({
|
|
|
project_id: this.project_id,
|
|
project_id: this.project_id,
|
|
|
doc_id: this.doc_id,
|
|
doc_id: this.doc_id,
|
|
|
- error: `doc not not found: /project/${this.project_id}/doc/${this.doc_id}`
|
|
|
|
|
|
|
+ error: `doc not not found: /project/${this.project_id}/doc/${this.doc_id}`,
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|