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

tests(timeline): make use of the EventFactory more #3673

Merged
merged 8 commits into from
Jul 10, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Jul 9, 2024

The TestTimeline had lots and lots of custom methods for creating test events and handling them immediately. Since the EventFactory helper makes it possible to easily create events, there's no need to repeat those responsibilities in the timeline testing code itself, and we can make more use of the EventFactory instead.

There's much more to do there; ideally, we'd get rid of most of TestTimeline::handle_ methods (we'd keep handle_live_events), as well as EventBuilder entirely, which API isn't flexible at all. Could be some nice and fun good-first-bugs 😎

This is `TimelineInner::add_events_at` with fixed parameters.
Callers can make use of the `EventFactory` which is easier to understand
IMO, and that avoids a special testing function just for this.
@bnjbvr bnjbvr requested a review from a team as a code owner July 9, 2024 18:03
@bnjbvr bnjbvr requested review from andybalaam and removed request for a team July 9, 2024 18:03
Copy link

codecov bot commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.

Project coverage is 84.30%. Comparing base (1bc0443) to head (eec9128).
Report is 2 commits behind head on main.

Files Patch % Lines
crates/matrix-sdk/src/test_utils/events.rs 76.47% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3673      +/-   ##
==========================================
- Coverage   84.31%   84.30%   -0.01%     
==========================================
  Files         259      259              
  Lines       26720    26726       +6     
==========================================
+ Hits        22529    22532       +3     
- Misses       4191     4194       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

Great, thanks!

…ine::handle_live_reaction`

The `EventFactory` is improved to support creating those events too,
reducing the number of custom events creators everywhere.
The `EventFactory` can build events with a specific `event_id` already.
@bnjbvr bnjbvr enabled auto-merge (rebase) July 10, 2024 09:24
@bnjbvr bnjbvr merged commit e1fbfbe into main Jul 10, 2024
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/timeline-testing branch July 10, 2024 09:39
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