Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for GapWriter, using a new timeline mock utility #494

Merged
merged 20 commits into from
Sep 23, 2021

Conversation

bwindels
Copy link
Contributor

@bwindels bwindels commented Sep 14, 2021

No description provided.

@bwindels bwindels changed the title Don't discard any events past an overlapping one when backfilling Don't discard any unknown events past an overlapping one when backfilling Sep 14, 2021
return {
"Backfilling an empty fragment": async assert => {
const { txn, fragmentIdComparer, gapWriter, eventCreator } = await setup();
const emptyFragment = await createFragment(0, txn, fragmentIdComparer, { previousToken: startToken });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you extract the fragment id here in a variable and reuse it when you check for the results below in the store? Now the relation is implicit, by using EventKey.minKey which also happens to use fragmentId 0, making the test work, but it's not apparent without knowing all of this.

src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/mocks/TimelineMock.ts Show resolved Hide resolved
src/mocks/TimelineMock.ts Outdated Show resolved Hide resolved
src/mocks/TimelineMock.ts Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
src/matrix/room/timeline/persistence/GapWriter.js Outdated Show resolved Hide resolved
@bwindels
Copy link
Contributor Author

Excellent work on the unit tests! Left some comments, and have some questions about the actual fix, we can discuss "in person" later on.

@bwindels bwindels changed the title Don't discard any unknown events past an overlapping one when backfilling Unit tests for GapWriter, using a new timeline mock utility Sep 23, 2021
@bwindels bwindels marked this pull request as ready for review September 23, 2021 08:15
@bwindels
Copy link
Contributor Author

Good to go, thanks again for this!

@bwindels bwindels merged commit 45917ea into master Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants