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

Open classes in uniffi rust bindings #2266

Closed
stefanceriu opened this issue Dec 19, 2023 · 3 comments
Closed

Open classes in uniffi rust bindings #2266

stefanceriu opened this issue Dec 19, 2023 · 3 comments
Assignees
Labels
A-DevX Anything that can improve the DevX Team: Chapter

Comments

@stefanceriu
Copy link
Member

One of the biggest problems we have in testing at the moment is that we cannot mock Rust side objects, both because they're not using protocols throughout and because they're not open.

Following the great work @jmartinesp did here we would like to make something similar available to swift developers. We should then be able to unit test more complex services layer files like the RoomTimelineItemFactory and RoomSummaryProvider

@stefanceriu stefanceriu added A-DevX Anything that can improve the DevX Team: Chapter labels Dec 19, 2023
@nimau
Copy link
Contributor

nimau commented Dec 28, 2023

The following PRs have been opened:

  • uniffi PR to build Swift mocks using uniffi
  • draft matrix-rust-sdk PR, which updates the Swift xtask to generate mocks when building the framework
  • draft element-x-ios PR, which updates the BuildSDK tool and adds some unit tests for ClientProxy that demonstrate how to use the generated Swift mocks.

@ara4n
Copy link
Member

ara4n commented Dec 28, 2023

Out of interest, has a mock-less approach been considered? cf https://accu.org/journals/overload/23/127/balaam_2108/ and https://cs-syd.eu/posts/2021-10-22-why-mocking-is-a-bad-idea and similar

@manuroe manuroe assigned stefanceriu and unassigned nimau Jan 2, 2024
@stefanceriu
Copy link
Member Author

This is now done in uniffi but without automocking (which they didn't accept) mozilla/uniffi-rs#1975

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-DevX Anything that can improve the DevX Team: Chapter
Projects
None yet
Development

No branches or pull requests

3 participants