You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would like to make writing unit tests for async/graphql related code easier.
Technically, we have code gen msw handlers: invoiceQueryMock. However, if we use them, the amount of random fields we need to add is outrageous!
Not 100% sure what the best thing to do is here but I do have some thoughts on what a great end goal could be..
Easily attach a msw handler to a msw server running in test files, without having to think about or handle the restarting of the server etc.
Easily generate simple mock objects, not having to specify every field
Easily modify values of fields on mock objects for a single test
I think if we had a way to have those 3 goals covered, it would be super nice and easy to write unit tests for any async work.
Right now, it's tedious and annoying which results in essentially.. not writing them 🤷
Some extra nice to haves:
Allow for whatever data that is generated to be used in some sort of end to end testing suite? For example, maybe using https://github.com/sorry-cypress/sorry-cypress to run tests to insert the data 🤷 I don't really know how this works.
The backend team also have mock data. We could work together to create a suite of json files to share the work load? Unsure if this is more troublesome than helpful!
The text was updated successfully, but these errors were encountered:
Replace the use of faker to instead parse over these json files
This way we could more easily use the msw server handlers in our test files, the same as we do as the msw worker handlers.
It might be best to keep the faker implementation in place for now. It is good to be able to generate large amounts of data? If we were to do that with JSON files, they might get pretty big?
that would be really good. Would be keen to remove faker at some point, it's a large package.
Having small data sets is fine - if we do need larger, could we just load the small set and repeat it a number of times, updating the ids?
Would like to implement end-to-end test suite too. after we get the MSW / unit tests going though 😉
Would like to make writing unit tests for async/graphql related code easier.
invoiceQueryMock
. However, if we use them, the amount of random fields we need to add is outrageous!I think if we had a way to have those 3 goals covered, it would be super nice and easy to write unit tests for any async work.
Right now, it's tedious and annoying which results in essentially.. not writing them 🤷
Some extra nice to haves:
The text was updated successfully, but these errors were encountered: