|
@@ -113,6 +113,15 @@ describe('Applying updates to a doc', function () {
|
|
|
body.should.deep.equal({})
|
|
body.should.deep.equal({})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ it('should set the project notification timestamp in Redis', async function () {
|
|
|
|
|
+ const timestamp = await rclientDU.get(
|
|
|
|
|
+ Keys.projectNotificationTimestamp({ project_id: this.project_id })
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(timestamp).to.exist
|
|
|
|
|
+ const timestampValue = parseInt(timestamp, 10)
|
|
|
|
|
+ timestampValue.should.be.within(this.startTime, Date.now())
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
describe('when sending another update', function () {
|
|
describe('when sending another update', function () {
|
|
|
beforeEach(async function () {
|
|
beforeEach(async function () {
|
|
|
this.timeout(10000)
|
|
this.timeout(10000)
|
|
@@ -158,6 +167,16 @@ describe('Applying updates to a doc', function () {
|
|
|
await DocUpdaterClient.getProjectLastUpdatedAt(this.project_id)
|
|
await DocUpdaterClient.getProjectLastUpdatedAt(this.project_id)
|
|
|
lastUpdatedAt.should.be.within(this.secondStartTime, Date.now())
|
|
lastUpdatedAt.should.be.within(this.secondStartTime, Date.now())
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ it('should not change the project notification timestamp', async function () {
|
|
|
|
|
+ const timestamp = await rclientDU.get(
|
|
|
|
|
+ Keys.projectNotificationTimestamp({ project_id: this.project_id })
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(timestamp).to.exist
|
|
|
|
|
+ const timestampValue = parseInt(timestamp, 10)
|
|
|
|
|
+ // Should still be within the first update time range, not the second
|
|
|
|
|
+ timestampValue.should.be.within(this.startTime, this.secondStartTime)
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('when another client is sending a concurrent update', function () {
|
|
describe('when another client is sending a concurrent update', function () {
|
|
@@ -275,6 +294,15 @@ describe('Applying updates to a doc', function () {
|
|
|
body.should.deep.equal({})
|
|
body.should.deep.equal({})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ it('should set the project notification timestamp in Redis', async function () {
|
|
|
|
|
+ const timestamp = await rclientDU.get(
|
|
|
|
|
+ Keys.projectNotificationTimestamp({ project_id: this.project_id })
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(timestamp).to.exist
|
|
|
|
|
+ const timestampValue = parseInt(timestamp, 10)
|
|
|
|
|
+ timestampValue.should.be.within(this.startTime, Date.now())
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
describe('when sending another update', function () {
|
|
describe('when sending another update', function () {
|
|
|
beforeEach(async function () {
|
|
beforeEach(async function () {
|
|
|
this.timeout(10000)
|
|
this.timeout(10000)
|
|
@@ -325,6 +353,16 @@ describe('Applying updates to a doc', function () {
|
|
|
await DocUpdaterClient.getProjectLastUpdatedAt(this.project_id)
|
|
await DocUpdaterClient.getProjectLastUpdatedAt(this.project_id)
|
|
|
lastUpdatedAt.should.be.within(this.secondStartTime, Date.now())
|
|
lastUpdatedAt.should.be.within(this.secondStartTime, Date.now())
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ it('should not change the project notification timestamp', async function () {
|
|
|
|
|
+ const timestamp = await rclientDU.get(
|
|
|
|
|
+ Keys.projectNotificationTimestamp({ project_id: this.project_id })
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(timestamp).to.exist
|
|
|
|
|
+ const timestampValue = parseInt(timestamp, 10)
|
|
|
|
|
+ // Should still be within the first update time range, not the second
|
|
|
|
|
+ timestampValue.should.be.within(this.startTime, this.secondStartTime)
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
describe('when another client is sending a concurrent update', function () {
|
|
describe('when another client is sending a concurrent update', function () {
|