Skip to content

Conversation

martin-hughes
Copy link

I questioned in issue #4685 whether the tests could be fixed using a sync channel to move the assertion to the main function body.

This PR demonstrates that.

It's not intended to be merged just yet. Instead I wanted to see if this was an approach you'd support for the other tests, and if so I'll go looking for similar problems and update this PR.

Any comments welcome of course! Especially if you know of an easier way to achieve the same thing.

Just FYI, I haven't run the full set of tests from https://dioxuslabs.com/learn/0.6/contributing/ - I will do so if you get to the point of considering a merge.

Notes:

  • You can check the logic by changing one of the "hello world" strings - the test will then fail (run cargo test to see this)
  • I changed the body text to "arbitrary text" to emphasise that it is not one of the test strings.
  • I've removed the multiplication of the Child elements, it didn't seem necessary for the purpose of the test - but I don't know why it was there to start with.

@martin-hughes martin-hughes requested a review from a team as a code owner September 23, 2025 20:44
This is consistent with the test immediately below.
@martin-hughes
Copy link
Author

I realised overnight the test immediately below the one I changed used a static atomic variable to get results out of the component - which looks much cleaner and simpler than what I wrote.

I've updated the PR to match. I'll go looking for other tests that could do with updating.

@martin-hughes
Copy link
Author

See also my comment #4685 (comment) which asks about another possible solution

@martin-hughes martin-hughes marked this pull request as draft September 24, 2025 20:50
This should fix a handful of tests that didn't correctly do their test.

In other places, comments should make it clearer *why* tests are how
they are.
}

#[test]
#[ignore] // Test doesn't do anything.
Copy link
Author

Choose a reason for hiding this comment

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

I might have misunderstood but I don't think this test generates any errors to bubble? I've marked it as ignore to flag it, but I'm open to changing or removing it.

}
}

#[component]
Copy link
Author

Choose a reason for hiding this comment

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

This component was unused

fn nested_suspense_resolves_client() {
use Mutation::*;

async fn poll_three_times() {
Copy link
Author

Choose a reason for hiding this comment

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

This exactly duplicated a function at the top of the file so removed for DRYness

fn create_without_cx() -> Signal<String> {
Signal::new("hello world".to_string())
}

Copy link
Author

Choose a reason for hiding this comment

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

I wasn't sure if this level of checking was overkill, but it checks that the signals are working...

@martin-hughes martin-hughes changed the title Suggested method for correcting integration tests Minor fixes for tests Oct 1, 2025
@martin-hughes martin-hughes marked this pull request as ready for review October 1, 2025 14:11
@martin-hughes
Copy link
Author

I looked through all of the tests directories and found a handful of tests that didn't seem to be working how I'd expect. I've also added a few comments and clarifications where I thought that would be useful for the next newcomer who looks at them.

Ready for review, happy to do any updates you want.

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.

1 participant