mock-inspect
mock-inspect copied to clipboard
Improve examples
The following points have been raised when the tool was being presented:
- The examples could be more accessible
We need to document what needs improving before this issue can be worked on
I think it would benefit from some more real world kind of use cases, for example the graphql responses used are not actual GQL response structures but mocked to provide an example of timing differences.
It would be good to provide step by step introductions to common use cases like:
- Mock a request in nodejs test
- Mock a request in jest
- Mock a request in jest for a React component
and similar common scenarios we expect.
The intros should provide some more fundamental understanding for users wanting to learn.. and also some result to copy and paste for users who want to be lazy 🙂
Examples in readme should include imports (we do for some, but definitely the first one on the page should have it too)
I added this PR #73 which i think is a good MVP of a full example showing how to mock a request, use that mockedRequest object in a test suite and logging the mocked data from the src file.
Hi Howard! I have only just now seen this as well as your PR - I don't seem to get notifications anymore now that I'm not in the trayio organization.
Could you please outline further what examples you would like to have and how you would expect them to look like? I'm asking as I'm all for more examples but I'm not clear yet on the proposed structure in PR #73. Also, what do you mean by "nodejs test" - jest runs already on nodejs. It would be nice though having a mocha example which shows how cleanUpNetworkRequestMocking()
etc. has to be called in the start-up phase.
In the readme we write:
For detailed examples on how to use each of these, check out our extensive suite of tests.
Perhaps we could instead link to specific tests in the readme? And make it clear where the start-up phase is happening and how it's done?
☝️ @aychtang as you might have not gotten a notification due to me not mentioning the GitHub name :)
Oh, hey @rickschubert - hope you've been well! Think if you watch the repo (next to star + fork) you will get notifications for these PR messages.
Was just a quick list I typed, not meant to be exhaustive, but basically the idea is like there should be "use case examples" for testing from say a file using stdlib of nodejs, one for express, one for react etc. I'm actually starting to think that these should live as totally separate repos which are linked to from the README, as they will have devdependencies which are not really related to mock-inspect
and I don't like the idea of passing those dependency requirements on to users of mock-inspect
.
So we should move that PR to mock-inspect-example-nodejs
and add mock-inspect-example-react
and stuff like that as we go, what do you think @rickschubert @thomaschaplin?
I don't think this should live inside the mock-inspect
repo as you've said @aychtang.
@aychtang suggested about using VS Code Tours - https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour