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

expectNoEvents() does not account for terminal events #348

Open
saket opened this issue Aug 23, 2024 · 2 comments
Open

expectNoEvents() does not account for terminal events #348

saket opened this issue Aug 23, 2024 · 2 comments

Comments

@saket
Copy link

saket commented Aug 23, 2024

When using expectNoEvents(), the method does consider that the flow's terminal event might have already been consumed.

flowOf("foo").test {
  skipItems(1)
  awaitComplete()
  expectNoEvents()
}

The above code produces this error:

TurbineAssertionError: Expected no events but found Complete

Additionally, it is currently possible to call awaitComplete() multiple times without any restriction. Should this be allowed?

flowOf("foo").test {
  skipItems(1)
  repeat(5) {
    awaitComplete()
  }
}
@JakeWharton
Copy link
Collaborator

So I don't forget:

Screenshot 2024-08-23 at 3 54 47 PM

@JakeWharton
Copy link
Collaborator

We can't really stop you from calling awaitComplete multiple times. We could have it return Nothing and throw some special internal exception that we catch in test { } and then return normally? But I'd kinda just rather let you do this and get the failure...

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

No branches or pull requests

2 participants