mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
decaffeinate: Run post-processing cleanups on DiffGeneratorTests.coffee and 13 other files
This commit is contained in:
parent
86a9593ec0
commit
a35c69c0c8
14 changed files with 139 additions and 65 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
@ -25,52 +31,46 @@ describe("DiffGenerator", function() {
|
||||||
};});
|
};});
|
||||||
|
|
||||||
describe("rewindOp", function() {
|
describe("rewindOp", function() {
|
||||||
describe("rewinding an insert", () =>
|
describe("rewinding an insert", function() { return it("should undo the insert", function() {
|
||||||
it("should undo the insert", function() {
|
|
||||||
const content = "hello world";
|
const content = "hello world";
|
||||||
const rewoundContent = this.DiffGenerator.rewindOp(content, { p: 6, i: "wo" });
|
const rewoundContent = this.DiffGenerator.rewindOp(content, { p: 6, i: "wo" });
|
||||||
return rewoundContent.should.equal("hello rld");
|
return rewoundContent.should.equal("hello rld");
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("rewinding a delete", () =>
|
describe("rewinding a delete", function() { return it("should undo the delete", function() {
|
||||||
it("should undo the delete", function() {
|
|
||||||
const content = "hello rld";
|
const content = "hello rld";
|
||||||
const rewoundContent = this.DiffGenerator.rewindOp(content, { p: 6, d: "wo" });
|
const rewoundContent = this.DiffGenerator.rewindOp(content, { p: 6, d: "wo" });
|
||||||
return rewoundContent.should.equal("hello world");
|
return rewoundContent.should.equal("hello world");
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("with an inconsistent update", () =>
|
describe("with an inconsistent update", function() { return it("should throw an error", function() {
|
||||||
it("should throw an error", function() {
|
|
||||||
const content = "hello world";
|
const content = "hello world";
|
||||||
return expect( () => {
|
return expect( () => {
|
||||||
return this.DiffGenerator.rewindOp(content, { p: 6, i: "foo" });
|
return this.DiffGenerator.rewindOp(content, { p: 6, i: "foo" });
|
||||||
}).to.throw(this.DiffGenerator.ConsistencyError);
|
}).to.throw(this.DiffGenerator.ConsistencyError);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
return describe("with an update which is beyond the length of the content", () =>
|
return describe("with an update which is beyond the length of the content", function() { return it("should undo the insert as if it were at the end of the content", function() {
|
||||||
it("should undo the insert as if it were at the end of the content", function() {
|
|
||||||
const content = "foobar";
|
const content = "foobar";
|
||||||
const rewoundContent = this.DiffGenerator.rewindOp(content, { p: 4, i: "bar" });
|
const rewoundContent = this.DiffGenerator.rewindOp(content, { p: 4, i: "bar" });
|
||||||
return rewoundContent.should.equal("foo");
|
return rewoundContent.should.equal("foo");
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("rewindUpdate", () =>
|
describe("rewindUpdate", function() { return it("should rewind ops in reverse", function() {
|
||||||
it("should rewind ops in reverse", function() {
|
|
||||||
const content = "aaabbbccc";
|
const content = "aaabbbccc";
|
||||||
const update =
|
const update =
|
||||||
{op: [{ p: 3, i: "bbb" }, { p: 6, i: "ccc" }]};
|
{op: [{ p: 3, i: "bbb" }, { p: 6, i: "ccc" }]};
|
||||||
const rewoundContent = this.DiffGenerator.rewindUpdate(content, update);
|
const rewoundContent = this.DiffGenerator.rewindUpdate(content, update);
|
||||||
return rewoundContent.should.equal("aaa");
|
return rewoundContent.should.equal("aaa");
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("rewindUpdates", () =>
|
describe("rewindUpdates", function() { return it("should rewind updates in reverse", function() {
|
||||||
it("should rewind updates in reverse", function() {
|
|
||||||
const content = "aaabbbccc";
|
const content = "aaabbbccc";
|
||||||
const updates = [
|
const updates = [
|
||||||
{ op: [{ p: 3, i: "bbb" }] },
|
{ op: [{ p: 3, i: "bbb" }] },
|
||||||
|
@ -78,7 +78,7 @@ describe("DiffGenerator", function() {
|
||||||
];
|
];
|
||||||
const rewoundContent = this.DiffGenerator.rewindUpdates(content, updates);
|
const rewoundContent = this.DiffGenerator.rewindUpdates(content, updates);
|
||||||
return rewoundContent.should.equal("aaa");
|
return rewoundContent.should.equal("aaa");
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("buildDiff", function() {
|
describe("buildDiff", function() {
|
||||||
|
@ -122,8 +122,7 @@ describe("DiffGenerator", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("compressDiff", function() {
|
describe("compressDiff", function() {
|
||||||
describe("with adjacent inserts with the same user_id", () =>
|
describe("with adjacent inserts with the same user_id", function() { return it("should create one update with combined meta data and min/max timestamps", function() {
|
||||||
it("should create one update with combined meta data and min/max timestamps", function() {
|
|
||||||
const diff = this.DiffGenerator.compressDiff([
|
const diff = this.DiffGenerator.compressDiff([
|
||||||
{ i: "foo", meta: { start_ts: 10, end_ts: 20, user: { id: this.user_id } }},
|
{ i: "foo", meta: { start_ts: 10, end_ts: 20, user: { id: this.user_id } }},
|
||||||
{ i: "bar", meta: { start_ts: 5, end_ts: 15, user: { id: this.user_id } }}
|
{ i: "bar", meta: { start_ts: 5, end_ts: 15, user: { id: this.user_id } }}
|
||||||
|
@ -131,22 +130,20 @@ describe("DiffGenerator", function() {
|
||||||
return expect(diff).to.deep.equal([
|
return expect(diff).to.deep.equal([
|
||||||
{ i: "foobar", meta: { start_ts: 5, end_ts: 20, user: { id: this.user_id } }}
|
{ i: "foobar", meta: { start_ts: 5, end_ts: 20, user: { id: this.user_id } }}
|
||||||
]);
|
]);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("with adjacent inserts with different user_ids", () =>
|
describe("with adjacent inserts with different user_ids", function() { return it("should leave the inserts unchanged", function() {
|
||||||
it("should leave the inserts unchanged", function() {
|
|
||||||
const input = [
|
const input = [
|
||||||
{ i: "foo", meta: { start_ts: 10, end_ts: 20, user: { id: this.user_id } }},
|
{ i: "foo", meta: { start_ts: 10, end_ts: 20, user: { id: this.user_id } }},
|
||||||
{ i: "bar", meta: { start_ts: 5, end_ts: 15, user: { id: this.user_id_2 } }}
|
{ i: "bar", meta: { start_ts: 5, end_ts: 15, user: { id: this.user_id_2 } }}
|
||||||
];
|
];
|
||||||
const output = this.DiffGenerator.compressDiff(input);
|
const output = this.DiffGenerator.compressDiff(input);
|
||||||
return expect(output).to.deep.equal(input);
|
return expect(output).to.deep.equal(input);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("with adjacent deletes with the same user_id", () =>
|
describe("with adjacent deletes with the same user_id", function() { return it("should create one update with combined meta data and min/max timestamps", function() {
|
||||||
it("should create one update with combined meta data and min/max timestamps", function() {
|
|
||||||
const diff = this.DiffGenerator.compressDiff([
|
const diff = this.DiffGenerator.compressDiff([
|
||||||
{ d: "foo", meta: { start_ts: 10, end_ts: 20, user: { id: this.user_id } }},
|
{ d: "foo", meta: { start_ts: 10, end_ts: 20, user: { id: this.user_id } }},
|
||||||
{ d: "bar", meta: { start_ts: 5, end_ts: 15, user: { id: this.user_id } }}
|
{ d: "bar", meta: { start_ts: 5, end_ts: 15, user: { id: this.user_id } }}
|
||||||
|
@ -154,18 +151,17 @@ describe("DiffGenerator", function() {
|
||||||
return expect(diff).to.deep.equal([
|
return expect(diff).to.deep.equal([
|
||||||
{ d: "foobar", meta: { start_ts: 5, end_ts: 20, user: { id: this.user_id } }}
|
{ d: "foobar", meta: { start_ts: 5, end_ts: 20, user: { id: this.user_id } }}
|
||||||
]);
|
]);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
return describe("with adjacent deletes with different user_ids", () =>
|
return describe("with adjacent deletes with different user_ids", function() { return it("should leave the deletes unchanged", function() {
|
||||||
it("should leave the deletes unchanged", function() {
|
|
||||||
const input = [
|
const input = [
|
||||||
{ d: "foo", meta: { start_ts: 10, end_ts: 20, user: { id: this.user_id } }},
|
{ d: "foo", meta: { start_ts: 10, end_ts: 20, user: { id: this.user_id } }},
|
||||||
{ d: "bar", meta: { start_ts: 5, end_ts: 15, user: { id: this.user_id_2 } }}
|
{ d: "bar", meta: { start_ts: 5, end_ts: 15, user: { id: this.user_id_2 } }}
|
||||||
];
|
];
|
||||||
const output = this.DiffGenerator.compressDiff(input);
|
const output = this.DiffGenerator.compressDiff(input);
|
||||||
return expect(output).to.deep.equal(input);
|
return expect(output).to.deep.equal(input);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -331,8 +327,7 @@ describe("DiffGenerator", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("deleting over existing deletes", () =>
|
describe("deleting over existing deletes", function() { return it("should delete across multiple (u)changed and (d)deleted text parts", function() {
|
||||||
it("should delete across multiple (u)changed and (d)deleted text parts", function() {
|
|
||||||
const diff = this.DiffGenerator.applyUpdateToDiff(
|
const diff = this.DiffGenerator.applyUpdateToDiff(
|
||||||
[ { u: "foo" }, { d: "baz", meta: this.meta }, { u: "bar" } ],
|
[ { u: "foo" }, { d: "baz", meta: this.meta }, { u: "bar" } ],
|
||||||
{ op: [{ p: 2, d: "ob" }], meta: this.meta }
|
{ op: [{ p: 2, d: "ob" }], meta: this.meta }
|
||||||
|
@ -344,7 +339,7 @@ describe("DiffGenerator", function() {
|
||||||
{ d: "b", meta: this.meta },
|
{ d: "b", meta: this.meta },
|
||||||
{ u: "ar" }
|
{ u: "ar" }
|
||||||
]);
|
]);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("deleting when the text doesn't match", function() {
|
describe("deleting when the text doesn't match", function() {
|
||||||
|
@ -376,8 +371,7 @@ describe("DiffGenerator", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when the last update in the existing diff is a delete", () =>
|
describe("when the last update in the existing diff is a delete", function() { return it("should insert the new update before the delete", function() {
|
||||||
it("should insert the new update before the delete", function() {
|
|
||||||
const diff = this.DiffGenerator.applyUpdateToDiff(
|
const diff = this.DiffGenerator.applyUpdateToDiff(
|
||||||
[ { u: "foo" }, { d: "bar", meta: this.meta } ],
|
[ { u: "foo" }, { d: "bar", meta: this.meta } ],
|
||||||
{ op: [{ p: 3, i: "baz" }], meta: this.meta }
|
{ op: [{ p: 3, i: "baz" }], meta: this.meta }
|
||||||
|
@ -387,11 +381,10 @@ describe("DiffGenerator", function() {
|
||||||
{ i: "baz", meta: this.meta },
|
{ i: "baz", meta: this.meta },
|
||||||
{ d: "bar", meta: this.meta }
|
{ d: "bar", meta: this.meta }
|
||||||
]);
|
]);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
return describe("when the only update in the existing diff is a delete", () =>
|
return describe("when the only update in the existing diff is a delete", function() { return it("should insert the new update after the delete", function() {
|
||||||
it("should insert the new update after the delete", function() {
|
|
||||||
const diff = this.DiffGenerator.applyUpdateToDiff(
|
const diff = this.DiffGenerator.applyUpdateToDiff(
|
||||||
[ { d: "bar", meta: this.meta } ],
|
[ { d: "bar", meta: this.meta } ],
|
||||||
{ op: [{ p: 0, i: "baz" }], meta: this.meta }
|
{ op: [{ p: 0, i: "baz" }], meta: this.meta }
|
||||||
|
@ -400,7 +393,7 @@ describe("DiffGenerator", function() {
|
||||||
{ d: "bar", meta: this.meta },
|
{ d: "bar", meta: this.meta },
|
||||||
{ i: "baz", meta: this.meta }
|
{ i: "baz", meta: this.meta }
|
||||||
]);
|
]);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
mocha/no-nested-tests,
|
||||||
|
no-return-assign,
|
||||||
|
no-undef,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
@ -95,8 +105,7 @@ describe("LockManager", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("deleteLock", () =>
|
describe("deleteLock", function() { return beforeEach(function() {
|
||||||
beforeEach(function() {
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
this.rclient.del = sinon.stub().callsArg(1);
|
this.rclient.del = sinon.stub().callsArg(1);
|
||||||
return this.LockManager.deleteLock(this.key, this.callback);
|
return this.LockManager.deleteLock(this.key, this.callback);
|
||||||
|
@ -111,7 +120,7 @@ describe("LockManager", function() {
|
||||||
return it("should call the callback", function() {
|
return it("should call the callback", function() {
|
||||||
return this.callback.called.should.equal(true);
|
return this.callback.called.should.equal(true);
|
||||||
});
|
});
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("getLock", function() {
|
describe("getLock", function() {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
@ -28,7 +34,7 @@ describe("MongoManager", function() {
|
||||||
return this.project_id = ObjectId().toString();
|
return this.project_id = ObjectId().toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => tk.reset());
|
afterEach(function() { return tk.reset(); });
|
||||||
|
|
||||||
describe("getLastCompressedUpdate", function() {
|
describe("getLastCompressedUpdate", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/* eslint-disable
|
||||||
|
mocha/no-identical-title,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
@ -38,7 +45,7 @@ describe("PackManager", function() {
|
||||||
return this.PackManager.MAX_COUNT = 512;
|
return this.PackManager.MAX_COUNT = 512;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => tk.reset());
|
afterEach(function() { return tk.reset(); });
|
||||||
|
|
||||||
describe("insertCompressedUpdates", function() {
|
describe("insertCompressedUpdates", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
@ -195,8 +202,7 @@ describe("PackManager", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("flushCompressedUpdates", () =>
|
describe("flushCompressedUpdates", function() { return describe("when there is no previous update", function() {
|
||||||
describe("when there is no previous update", function() {
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
return this.PackManager.flushCompressedUpdates(this.project_id, this.doc_id, null, this.newUpdates, true, this.callback);
|
return this.PackManager.flushCompressedUpdates(this.project_id, this.doc_id, null, this.newUpdates, true, this.callback);
|
||||||
});
|
});
|
||||||
|
@ -223,7 +229,7 @@ describe("PackManager", function() {
|
||||||
return this.callback.called.should.equal(true);
|
return this.callback.called.should.equal(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
describe("when there is a recent previous update in mongo that expires", function() {
|
describe("when there is a recent previous update in mongo that expires", function() {
|
||||||
|
@ -454,9 +460,9 @@ describe("PackManager", function() {
|
||||||
|
|
||||||
|
|
||||||
function __range__(left, right, inclusive) {
|
function __range__(left, right, inclusive) {
|
||||||
let range = [];
|
const range = [];
|
||||||
let ascending = left < right;
|
const ascending = left < right;
|
||||||
let end = !inclusive ? right : ascending ? right + 1 : right - 1;
|
const end = !inclusive ? right : ascending ? right + 1 : right - 1;
|
||||||
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
|
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
|
||||||
range.push(i);
|
range.push(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
@ -494,8 +500,7 @@ describe("UpdateCompressor", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("noop - insert", () =>
|
describe("noop - insert", function() { return it("should leave them untouched", function() {
|
||||||
it("should leave them untouched", function() {
|
|
||||||
return expect(this.UpdateCompressor.compressUpdates([{
|
return expect(this.UpdateCompressor.compressUpdates([{
|
||||||
op: this.UpdateCompressor.NOOP,
|
op: this.UpdateCompressor.NOOP,
|
||||||
meta: { ts: this.ts1, user_id: this.user_id
|
meta: { ts: this.ts1, user_id: this.user_id
|
||||||
|
@ -518,11 +523,10 @@ describe("UpdateCompressor", function() {
|
||||||
},
|
},
|
||||||
v: 43
|
v: 43
|
||||||
}]);
|
}]);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
|
|
||||||
return describe("noop - delete", () =>
|
return describe("noop - delete", function() { return it("should leave them untouched", function() {
|
||||||
it("should leave them untouched", function() {
|
|
||||||
return expect(this.UpdateCompressor.compressUpdates([{
|
return expect(this.UpdateCompressor.compressUpdates([{
|
||||||
op: this.UpdateCompressor.NOOP,
|
op: this.UpdateCompressor.NOOP,
|
||||||
meta: { ts: this.ts1, user_id: this.user_id
|
meta: { ts: this.ts1, user_id: this.user_id
|
||||||
|
@ -545,13 +549,11 @@ describe("UpdateCompressor", function() {
|
||||||
},
|
},
|
||||||
v: 43
|
v: 43
|
||||||
}]);
|
}]);
|
||||||
})
|
}); }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return describe("compressRawUpdates", () =>
|
return describe("compressRawUpdates", function() { return describe("merging in-place with an array op", function() { return it("should not change the existing last updates", function() {
|
||||||
describe("merging in-place with an array op", () =>
|
|
||||||
it("should not change the existing last updates", function() {
|
|
||||||
return expect(this.UpdateCompressor.compressRawUpdates({
|
return expect(this.UpdateCompressor.compressRawUpdates({
|
||||||
op: [ {"p":1000,"d":"hello"}, {"p":1000,"i":"HELLO()"} ],
|
op: [ {"p":1000,"d":"hello"}, {"p":1000,"i":"HELLO()"} ],
|
||||||
meta: { start_ts: this.ts1, end_ts: this.ts1, user_id: this.user_id
|
meta: { start_ts: this.ts1, end_ts: this.ts1, user_id: this.user_id
|
||||||
|
@ -574,15 +576,15 @@ describe("UpdateCompressor", function() {
|
||||||
},
|
},
|
||||||
v: 43
|
v: 43
|
||||||
}]);
|
}]);
|
||||||
})
|
}); }
|
||||||
)
|
); }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
function __range__(left, right, inclusive) {
|
function __range__(left, right, inclusive) {
|
||||||
let range = [];
|
const range = [];
|
||||||
let ascending = left < right;
|
const ascending = left < right;
|
||||||
let end = !inclusive ? right : ascending ? right + 1 : right - 1;
|
const end = !inclusive ? right : ascending ? right + 1 : right - 1;
|
||||||
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
|
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
|
||||||
range.push(i);
|
range.push(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
@ -27,7 +33,7 @@ describe("UpdateTrimmer", function() {
|
||||||
return this.project_id = "mock-project-id";
|
return this.project_id = "mock-project-id";
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => tk.reset());
|
afterEach(function() { return tk.reset(); });
|
||||||
|
|
||||||
return describe("shouldTrimUpdates", function() {
|
return describe("shouldTrimUpdates", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/* eslint-disable
|
||||||
|
camelcase,
|
||||||
|
handle-callback-err,
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS101: Remove unnecessary use of Array.from
|
* DS101: Remove unnecessary use of Array.from
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/* eslint-disable
|
||||||
|
no-return-assign,
|
||||||
|
no-unused-vars,
|
||||||
|
*/
|
||||||
|
// TODO: This file was created by bulk-decaffeinate.
|
||||||
|
// Fix any style issues and re-enable lint.
|
||||||
/*
|
/*
|
||||||
* decaffeinate suggestions:
|
* decaffeinate suggestions:
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
* DS102: Remove unnecessary code created because of implicit returns
|
||||||
|
|
Loading…
Reference in a new issue