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

Refactor the widget tests to use MockMatrixServer #4236

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

toger5
Copy link
Contributor

@toger5 toger5 commented Nov 8, 2024

This is a follow up PR on: #3987
And tries to use the MockMatrixServer wherever reasonable in the widget integration tests.

  • Public API changes documented in changelogs (optional)

Signed-off-by:

Base automatically changed from toger5/widget-driver-redactions to main November 8, 2024 13:21
@toger5 toger5 force-pushed the toger5/mock-matrix-server-widget-tests branch from b0790c0 to a628d83 Compare November 8, 2024 15:25
Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 81.48148% with 5 lines in your changes missing coverage. Please review.

Project coverage is 84.92%. Comparing base (aca83fb) to head (f3f39d2).
Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/test_utils/mocks.rs 81.48% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4236      +/-   ##
==========================================
- Coverage   84.92%   84.92%   -0.01%     
==========================================
  Files         274      274              
  Lines       29805    29831      +26     
==========================================
+ Hits        25311    25333      +22     
- Misses       4494     4498       +4     

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

@poljar poljar changed the title Toger5/mock-matrix-server-widget-tests Refactor the widget tests to use MockMatrixServer Nov 8, 2024
@toger5 toger5 force-pushed the toger5/mock-matrix-server-widget-tests branch from a628d83 to b345d64 Compare November 13, 2024 16:02
@toger5
Copy link
Contributor Author

toger5 commented Nov 13, 2024

How do i test /test_utils/mocks.rs?

@toger5 toger5 force-pushed the toger5/mock-matrix-server-widget-tests branch from b345d64 to c573c2d Compare November 13, 2024 16:11
@bnjbvr
Copy link
Member

bnjbvr commented Nov 13, 2024

How do i test /test_utils/mocks.rs?

We usually don't test the test utilities; they should be straightforward enough that using them in tests would reveal their issues.

@toger5 toger5 force-pushed the toger5/mock-matrix-server-widget-tests branch from c573c2d to e8d57ca Compare November 13, 2024 16:18
@poljar
Copy link
Contributor

poljar commented Nov 13, 2024

How do i test /test_utils/mocks.rs?

Examples in the docstrings will be run as the doc tests which can run and test the mocks. At least that's how I wrote all the examples for the MatrixMockServer.

@toger5 toger5 marked this pull request as ready for review November 13, 2024 19:15
@toger5 toger5 requested a review from a team as a code owner November 13, 2024 19:15
@toger5 toger5 requested review from Hywan, bnjbvr and poljar and removed request for a team and bnjbvr November 13, 2024 19:15
@poljar poljar removed the request for review from Hywan November 14, 2024 16:13
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 working on this. Left a couple of nits about linkifying doc references and a couple more examples would be neat.

crates/matrix-sdk/src/test_utils/mocks.rs Outdated Show resolved Hide resolved
///
/// # Examples
///
/// see also [mock_room_send] for more context.
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
/// see also [mock_room_send] for more context.
/// see also [`MatrixMockServer::mock_room_send`] for more context.

crates/matrix-sdk/src/test_utils/mocks.rs Outdated Show resolved Hide resolved
/// Similar to: [mock_room_send]
///
/// Note: works with *any* room.
/// Note: works with *any* event type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to add an example for this one as well.

crates/matrix-sdk/src/test_utils/mocks.rs Outdated Show resolved Hide resolved
///
/// Similar to: [mock_room_send]
///
/// Note: works with *any* room.
Copy link
Contributor

Choose a reason for hiding this comment

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

An example would be nice as well, they would have helped you when you first encountered the MatrixMockServer.

crates/matrix-sdk/src/test_utils/mocks.rs Outdated Show resolved Hide resolved
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.

3 participants