A platform for community discussion. Free, open, simple.
FIX: test for fillGapBefore (#10272)
Krzysztof Kotlareke48e64456d5c
diff --git a/test/javascripts/models/post-stream-test.js b/test/javascripts/models/post-stream-test.jsindex dbcc4b5ca8b..d68f767fb79 100644--- a/test/javascripts/models/post-stream-test.js+++ b/test/javascripts/models/post-stream-test.js@@ -247,6 +247,23 @@ QUnit.test("findPostIdForPostNumber", assert => {assert.equal(postStream.findPostIdForPostNumber(8), 60, "it respects gaps");});+QUnit.test("fillGapBefore", assert => {+ const postStream = buildStream(1234, [60]);+ sandbox.stub(postStream, "findPostsByIds").returns(Promise.resolve([]));+ let post = postStream.store.createRecord("post", { id: 60, post_number: 60 });+ postStream.set("gaps", {+ before: { 60: [51, 52, 53, 54, 55, 56, 57, 58, 59] }+ });++ postStream.fillGapBefore(post, [51, 52, 53, 54, 55, 56, 57, 58, 59]);++ assert.deepEqual(+ postStream.stream,+ [51, 52, 53, 54, 55, 60],+ "partial results are included in the stream"+ );+});+QUnit.test("toggleParticipant", assert => {const postStream = buildStream(1236);sandbox.stub(postStream, "refresh").returns(Promise.resolve());