redbadger / crux

Cross-platform app development in Rust
https://redbadger.github.io/crux/
Apache License 2.0
1.71k stars 60 forks source link

RFC: Testing convenience API #171

Open charypar opened 9 months ago

charypar commented 9 months ago

This is a list of nice to have APIs on the AppTester to make tests a little bit verbose in common cases. I'll be updating this issue as I think of them. We can also discuss them as we go, and when there's a few of them, I'll open a PR implementing them.

charypar commented 8 months ago

Further thoughts:

adwhit commented 4 months ago

I would like some helper methods on Update:

fn assert_one_event(self) -> Event;
fn assert_one_effect(self) -> Effect;

These would check that there is exactly one event/effect (and no effects/events) and return it. Names bikeshedable.

I would like the type that you get from app.resolve(..) to be something other than Update (Resolve?). I am always getting confused about where the update comes from and where it should go.

charypar commented 4 months ago

Update::settled() -> bool, which checks that events and effects are both empty would be handy.