Skip to content

test(sdk): Add test for maybe_apply_new_redaction #4760

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

Merged

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Mar 5, 2025

Follow up of #4740. I forgot to add a test!

This patch adds a test for maybe_apply_new_redaction when the redacted event is not loaded in-memory, i.e. when it lives in the store only.


@Hywan Hywan requested a review from a team as a code owner March 5, 2025 15:27
@Hywan Hywan requested review from bnjbvr and removed request for a team March 5, 2025 15:27
Copy link

codecov bot commented Mar 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.28%. Comparing base (1d7c60c) to head (30a1eea).
Report is 29 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4760   +/-   ##
=======================================
  Coverage   86.28%   86.28%           
=======================================
  Files         290      290           
  Lines       34281    34281           
=======================================
+ Hits        29578    29581    +3     
+ Misses       4703     4700    -3     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

Thanks for adding the forgotten test. I left a small suggestion but feel free to ignore.

Comment on lines 1680 to 1682
AnySyncTimelineEvent::MessageLike(AnySyncMessageLikeEvent::RoomMessage(event)) => {
// The event has been redacted!
assert!(event.as_original().is_none());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
AnySyncTimelineEvent::MessageLike(AnySyncMessageLikeEvent::RoomMessage(event)) => {
// The event has been redacted!
assert!(event.as_original().is_none());
AnySyncTimelineEvent::MessageLike(event) => {
// The event has been redacted!
assert!(event.is_redacted());

Not quite the same, but if we only care about the fact that the event is redacted might be nicer to read.

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool, didn't know about this one! Fixed up and rebased.

@poljar poljar removed the request for review from bnjbvr March 5, 2025 15:41
This patch adds a test for `maybe_apply_new_redaction` when the redacted
event is not loaded in-memory, i.e. when it lives in the store only.
@Hywan Hywan force-pushed the test-sdk-event-cache-maybe_apply_new_redaction branch from 208e6ed to 30a1eea Compare March 10, 2025 08:27
@Hywan Hywan enabled auto-merge (rebase) March 10, 2025 08:31
@Hywan Hywan merged commit b5a2308 into matrix-org:main Mar 10, 2025
43 checks passed
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