Test appending as well as prepending

This commit is contained in:
Danila Fedorin 2021-09-17 14:42:52 -07:00
parent 906f95baf9
commit 668fb37da9

View file

@ -544,7 +544,7 @@ export function tests() {
assert.equal(contextFragment.nextId, null); assert.equal(contextFragment.nextId, null);
assert.equal(syncFragment.previousId, null); assert.equal(syncFragment.previousId, null);
}, },
"Context sync near another fragment appends to that fragment.": async assert => { "Context sync after another fragment appends to that fragment.": async assert => {
const mocks = await setup(); const mocks = await setup();
const { timelineMock } = mocks; const { timelineMock } = mocks;
timelineMock.append(20); timelineMock.append(20);
@ -556,6 +556,18 @@ export function tests() {
const events = await allFragmentEvents(mocks, firstFragments[0].id); const events = await allFragmentEvents(mocks, firstFragments[0].id);
assert.deepEqual(events.map(e => e.event_id), eventIds(0, 16)); assert.deepEqual(events.map(e => e.event_id), eventIds(0, 16));
}, },
"Context sync before another fragment prepends to that fragment.": async assert => {
const mocks = await setup();
const { timelineMock } = mocks;
timelineMock.append(20);
const {fragments: firstFragments} = await contextAndWrite(mocks, eventId(11));
const {fragments: secondFragments} = await contextAndWrite(mocks, eventId(5));
assert.equal(firstFragments.length, 1);
assert.equal(secondFragments.length, 0);
const events = await allFragmentEvents(mocks, firstFragments[0].id);
assert.deepEqual(events.map(e => e.event_id), eventIds(0, 16));
},
"Context sync between two fragments links the two fragments, and fills one of them.": async assert => { "Context sync between two fragments links the two fragments, and fills one of them.": async assert => {
const mocks = await setup(); const mocks = await setup();
const { timelineMock } = mocks; const { timelineMock } = mocks;