hackgvl / open-map-data-multi-layers-demo

A bookmarkable map displaying all layers from HackGreenville Labs' Open Map Data
https://hackgvl.github.io/open-map-data-multi-layers-demo/
MIT License
2 stars 2 forks source link

Mock data.openupstate.org requests in tests #4

Closed oliviasculley closed 11 months ago

oliviasculley commented 1 year ago

Mock/intercept data.openupstate.org api calls to prevent them from affecting the tests

Need to mock in:

ThorntonMatthewD commented 1 year ago

I've really enjoyed utilizing [VCR]() with Rails to record responses from live APIs with built-in means to update them. This helps to prevent the issue of mocks becoming out-of-sync with prod from being an issue and giving devs very representative data to test with.

It looks like VCR has a node port named Talkback that would check this box. I have a prototype sort of set up: https://github.com/hackgvl/open-map-data-multi-layers-demo/compare/stable...ThorntonMatthewD:open-map-data-multi-layers-demo:MattT/mock-responses-talkback

I haven't worked much work with Vue, so I'm not entirely sure what the best practice is for where to stash test files and configs. I feel like I'm sort of littering the root folder at the moment and would like to relocate some of the new files. Do you have a preference where test configuration files should live?

oliviasculley commented 1 year ago

I don't personally have any preferences, but I'd prefer us to follow whatever conventions are in place with Vue's community since we're using their stuff. I think https://vuejs.org/guide/scaling-up/testing.html might describe some conventions, but if not, we can just look at what other Vue projects do.

Using something like Talkback that could let us easily not just mock but update the mocks sounds fantastic!

ThorntonMatthewD commented 1 year ago

Thank you! I will keep digging around and seeing what looks good.

ThorntonMatthewD commented 1 year ago

I've moved the tests into a single folder that has a hierarchy that resembles what is up in src for the regular application code. The configs and tapes have been placed into that folder, and now things look a lot more contained.

https://github.com/hackgvl/open-map-data-multi-layers-demo/compare/stable...ThorntonMatthewD:open-map-data-multi-layers-demo:MattT/mock-responses-talkback