From 39f528bcbcbc82cce5f137462a4d52668ce3330e Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 11 Sep 2015 14:12:01 +0100 Subject: [PATCH] Add a test to check that users are summarised properly even when a null user occurs earlier in the update list. --- .../UpdatesManager/UpdatesManagerTests.coffee | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/services/track-changes/test/unit/coffee/UpdatesManager/UpdatesManagerTests.coffee b/services/track-changes/test/unit/coffee/UpdatesManager/UpdatesManagerTests.coffee index 545fa18ca0..fc8853f2ab 100644 --- a/services/track-changes/test/unit/coffee/UpdatesManager/UpdatesManagerTests.coffee +++ b/services/track-changes/test/unit/coffee/UpdatesManager/UpdatesManagerTests.coffee @@ -655,6 +655,33 @@ describe "UpdatesManager", -> end_ts: @now + 30 }] + it "should include null user values, when the null is earlier in the updates list", -> + result = @UpdatesManager._summarizeUpdates [{ + doc_id: "doc-id-1" + meta: + user: null + start_ts: @now + end_ts: @now + 10 + v: 4 + }, { + doc_id: "doc-id-1" + meta: + user: @user_1 + start_ts: @now + 20 + end_ts: @now + 30 + v: 5 + }] + expect(result).to.deep.equal [{ + docs: + "doc-id-1": + fromV: 4 + toV: 5 + meta: + users: [null, @user_1] + start_ts: @now + end_ts: @now + 30 + }] + it "should roll several null user values into one", -> result = @UpdatesManager._summarizeUpdates [{ doc_id: "doc-id-1"