|
@@ -3,13 +3,6 @@
|
|
|
handle-callback-err,
|
|
handle-callback-err,
|
|
|
no-return-assign,
|
|
no-return-assign,
|
|
|
*/
|
|
*/
|
|
|
-// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
|
-// Fix any style issues and re-enable lint.
|
|
|
|
|
-/*
|
|
|
|
|
- * decaffeinate suggestions:
|
|
|
|
|
- * DS207: Consider shorter variations of null checks
|
|
|
|
|
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
|
- */
|
|
|
|
|
const sinon = require('sinon')
|
|
const sinon = require('sinon')
|
|
|
const chai = require('chai')
|
|
const chai = require('chai')
|
|
|
chai.should()
|
|
chai.should()
|
|
@@ -66,7 +59,7 @@ describe('Setting a document', function () {
|
|
|
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) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
@@ -74,7 +67,7 @@ describe('Setting a document', function () {
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.update,
|
|
this.update,
|
|
|
(error) => {
|
|
(error) => {
|
|
|
- if (error != null) {
|
|
|
|
|
|
|
+ if (error) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -136,7 +129,7 @@ describe('Setting a document', function () {
|
|
|
|
|
|
|
|
it('should leave the document in redis', function (done) {
|
|
it('should leave the document in redis', function (done) {
|
|
|
rclient_du.get(Keys.docLines({ doc_id: this.doc_id }), (error, lines) => {
|
|
rclient_du.get(Keys.docLines({ doc_id: this.doc_id }), (error, lines) => {
|
|
|
- if (error != null) {
|
|
|
|
|
|
|
+ if (error) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
expect(JSON.parse(lines)).to.deep.equal(this.newLines)
|
|
expect(JSON.parse(lines)).to.deep.equal(this.newLines)
|
|
@@ -195,7 +188,7 @@ describe('Setting a document', function () {
|
|
|
|
|
|
|
|
it('should remove the document from redis', function (done) {
|
|
it('should remove the document from redis', function (done) {
|
|
|
rclient_du.get(Keys.docLines({ doc_id: this.doc_id }), (error, lines) => {
|
|
rclient_du.get(Keys.docLines({ doc_id: this.doc_id }), (error, lines) => {
|
|
|
- if (error != null) {
|
|
|
|
|
|
|
+ if (error) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
expect(lines).to.not.exist
|
|
expect(lines).to.not.exist
|
|
@@ -330,7 +323,7 @@ describe('Setting a document', function () {
|
|
|
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) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
@@ -338,7 +331,7 @@ describe('Setting a document', function () {
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.update,
|
|
this.update,
|
|
|
(error) => {
|
|
(error) => {
|
|
|
- if (error != null) {
|
|
|
|
|
|
|
+ if (error) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
// Go back to old lines, with undo flag
|
|
// Go back to old lines, with undo flag
|
|
@@ -370,7 +363,7 @@ describe('Setting a document', function () {
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
(error, res, data) => {
|
|
(error, res, data) => {
|
|
|
- if (error != null) {
|
|
|
|
|
|
|
+ if (error) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
const { ranges } = data
|
|
const { ranges } = data
|
|
@@ -390,7 +383,7 @@ describe('Setting a document', function () {
|
|
|
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) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
DocUpdaterClient.sendUpdate(
|
|
DocUpdaterClient.sendUpdate(
|
|
@@ -398,7 +391,7 @@ describe('Setting a document', function () {
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
this.update,
|
|
this.update,
|
|
|
(error) => {
|
|
(error) => {
|
|
|
- if (error != null) {
|
|
|
|
|
|
|
+ if (error) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
// Go back to old lines, without undo flag
|
|
// Go back to old lines, without undo flag
|
|
@@ -430,7 +423,7 @@ describe('Setting a document', function () {
|
|
|
this.project_id,
|
|
this.project_id,
|
|
|
this.doc_id,
|
|
this.doc_id,
|
|
|
(error, res, data) => {
|
|
(error, res, data) => {
|
|
|
- if (error != null) {
|
|
|
|
|
|
|
+ if (error) {
|
|
|
throw error
|
|
throw error
|
|
|
}
|
|
}
|
|
|
const { ranges } = data
|
|
const { ranges } = data
|