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

USB Mocking: Allow 0 Repeated Status Calls #4045

Closed
adghayes opened this issue Oct 6, 2023 · 2 comments
Closed

USB Mocking: Allow 0 Repeated Status Calls #4045

adghayes opened this issue Oct 6, 2023 · 2 comments

Comments

@adghayes
Copy link
Collaborator

adghayes commented Oct 6, 2023

MockFunction allows you to mock repeated calls, but it means at least one call. That makes sense in most of the polling contexts it is being used for. But it doesn't make sense in all environments. For example, with USB mocking, we are mocking the USB status every time it is mock inserted or mock removed. But the status must be polled between each insert or remove so the MockFunction state can progress to the next mocked value. I think it's very confusing and problematic that the success or failure of the test can depend on whether we write an assertion or not (the backend itself is not polling).

We should either:

  1. Enable "0 or more" repeated calls via MockFunction
  2. Just use jest functions for the MockUsbDrive
@adghayes
Copy link
Collaborator Author

adghayes commented Oct 6, 2023

@jonahkagan thoughts on 1 vs. 2?

@adghayes
Copy link
Collaborator Author

I think @arsalansufi resolved this by resetting the mocked functions after every insert and remove.

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

1 participant