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

Commonize Socket Mocks #2636

Open
adrastaea opened this issue Oct 8, 2024 · 0 comments
Open

Commonize Socket Mocks #2636

adrastaea opened this issue Oct 8, 2024 · 0 comments

Comments

@adrastaea
Copy link
Collaborator

Description

Currently, we do a fair amount of socket communication between the redux sagas and backend, and will do more as more control is allocated to the backend. The issue is that every test redefines their own socket mock, and use different methods for doing so. This makes keeping tests up to date with the expected socket responses very tedious as you have to track down every definition and update them. We can probably create a common SocketMock class used by every test across desktop and state-manager that provides the sagas with the same expected responses to emitWithAck across tests. Then, developers will only need to update the socket mock in one place.

Potential complications may arise if we expect that a socket action will respond with different values across different calls.

Acceptance Criteria

  1. Custom SocketMock class injected into all saga tests
  2. All socket actions defined in startConnectionSaga are defined with responses in SocketMock
  3. API for overriding emitWithAck responses (maybe define each response as a function that can be overridden in the instance constructed by the test and then use a switch for calling the correct function in the emitWithAck mock
@adrastaea adrastaea added this to Quiet Oct 8, 2024
@adrastaea adrastaea moved this to Backlog - Desktop & Backend in Quiet Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog - Desktop & Backend
Development

No branches or pull requests

1 participant