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

feat: Rewrite root module, define listeners, draft MockManager #14

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

almeida1492
Copy link
Contributor

@almeida1492 almeida1492 commented Nov 29, 2022

This proposal uses both methods addEventListener and sendMessage to create intercommunication between the actual client application and the mock manager interface. By the use of this technique, it is possible to override the MSW handlers, change the mocked data at runtime, and keep the code of the Mock Manager and the client app separated into two different components trees.

To verify the behavior, do the following:

  1. Reinstall the dependencies, because I've updated react;
  2. Run the dev server with yarn run dev;
  3. Open it up at http://localhost:1234/;
  4. Submit the form;
  5. See the message returned by the worker at the HTTP call interception (This is the original response message);
  6. Click on "Open Mock Manager";
  7. Enter some data in the JSON editor and submit it;
  8. Return to the previous app (the one with the name-and-surname form) and try to submit the form again;
  9. See the mocked data overridden by the data you've just entered in the Mock Manager form.

@almeida1492 almeida1492 self-assigned this Nov 29, 2022
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