FIX: test for fillGapBefore (#10272)

Missing test for that PR https://github.com/discourse/discourse/pull/10264
This commit is contained in:
Krzysztof Kotlarek 2020-07-22 07:33:55 +10:00 committed by GitHub
parent 0ed784b4fc
commit e48e64456d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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());