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

Add more functionality to the room list vm #29402

Merged
merged 2 commits into from
Mar 5, 2025

Conversation

MidhunSureshR
Copy link
Member

  • Listen for updates from the store
  • Provide a method to open rooms

- Listen for updates from the store
- Provide a method to open rooms
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

Looks like insufficient coverage

@MidhunSureshR
Copy link
Member Author

About the coverage, there's already tests for this in https://github.com/element-hq/element-web/pull/29368/files#diff-9d33891dc652c5aa536ce75c66f8e212abc4f4fb002f6599d518eec498e1fed6R37-R52. Will try to avoid this happening in future but would appreciate an exception this time.

@MidhunSureshR MidhunSureshR requested a review from t3chguy March 4, 2025 13:22
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

I suggest copying the tests over or something as this should not land without coverage. I don't see any reason why this code needs an exception, the approach looks perfectly testable.

@florianduros
Copy link
Member

florianduros commented Mar 4, 2025

I agree with t3chguy.
Imo, the view model should be tested independently of the view. It shouldn't rely on the view tests for its testing.

In #29368, the room list tests mock the view model. So any change to the view model is not covered by my PR's unit tests.

@MidhunSureshR
Copy link
Member Author

Writing individual tests for the views and view models means testing the implementation rather than the behaviour. This is antithetical to the philosophy of RTL, see https://testing-library.com/docs/guiding-principles. We will end up with a lot of view only tests that provide little value eg: asserting that clicking a button calls the right method in the vm. We will end up with multiple tests that fail on even minor refactoring. Worse yet, testing the behaviour becomes optional since the only other way we can test the behaviour is through playwright tests and they are optional.

Anyhow, have added the tests to get this PR merged.

@MidhunSureshR MidhunSureshR requested a review from t3chguy March 5, 2025 07:35
@MidhunSureshR MidhunSureshR added this pull request to the merge queue Mar 5, 2025
Merged via the queue into develop with commit e9a3625 Mar 5, 2025
34 checks passed
@MidhunSureshR MidhunSureshR deleted the midhun/rls/room-list-vm-2 branch March 5, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants