Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

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 requested a review from aditecco November 29, 2022 15:25
@almeida1492 almeida1492 self-assigned this Nov 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant