mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Record project notification timestamp in Redis on applyUpdate (#29509)
* Record project notification timestamp in Redis on applyUpdate * Refactor project notification timestamp recording in Redis * Remove tests which are catching errors that are no longer used GitOrigin-RevId: faa7a97fa929941cade5d62d2d680c6c3f34cdc8
This commit is contained in:
committed by
Copybot
parent
239e89a0a8
commit
8bca2545ee
@@ -35,6 +35,7 @@ describe('UpdateManager', function () {
|
||||
promises: {
|
||||
setDocument: sinon.stub().resolves(),
|
||||
updateDocument: sinon.stub(),
|
||||
recordProjectNotificationTimestamp: sinon.stub().resolves(),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -416,6 +417,55 @@ describe('UpdateManager', function () {
|
||||
this.historyUpdates.length
|
||||
)
|
||||
})
|
||||
|
||||
it('should record the project notification timestamp', function () {
|
||||
this.RedisManager.promises.recordProjectNotificationTimestamp.should.have.been.calledWith(
|
||||
this.project_id,
|
||||
sinon.match.number
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when update has a timestamp in meta', function () {
|
||||
beforeEach(async function () {
|
||||
this.timestamp = 1234567890
|
||||
this.update = {
|
||||
op: [{ p: 42, i: 'foo' }],
|
||||
meta: { ...this.updateMeta, ts: this.timestamp },
|
||||
}
|
||||
await this.UpdateManager.promises.applyUpdate(
|
||||
this.project_id,
|
||||
this.doc_id,
|
||||
this.update
|
||||
)
|
||||
})
|
||||
|
||||
it('should record the project notification timestamp with the provided timestamp', function () {
|
||||
this.RedisManager.promises.recordProjectNotificationTimestamp.should.have.been.calledWith(
|
||||
this.project_id,
|
||||
this.timestamp
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when there are no history updates', function () {
|
||||
beforeEach(async function () {
|
||||
this.RangesManager.applyUpdate.returns({
|
||||
newRanges: this.updated_ranges,
|
||||
rangesWereCollapsed: false,
|
||||
historyUpdates: [],
|
||||
})
|
||||
await this.UpdateManager.promises.applyUpdate(
|
||||
this.project_id,
|
||||
this.doc_id,
|
||||
this.update
|
||||
)
|
||||
})
|
||||
|
||||
it('should not record the project notification timestamp', function () {
|
||||
this.RedisManager.promises.recordProjectNotificationTimestamp.should.not
|
||||
.have.been.called
|
||||
})
|
||||
})
|
||||
|
||||
describe('with UTF-16 surrogate pairs in the update', function () {
|
||||
|
||||
Reference in New Issue
Block a user