Using Mirage with Testing Library to mock the networkJanuary 31, 2020 at 3:36pm (Edited 2 months ago)
Hey Testing Library community!
I've been using TL more and more recently and really love it. I've worked a lot with Ember's testing in the past and philosophically, TL is very aligned with that. The goal is to always keep tests written at one level of abstraction, and the highest-level UI tests should be written from the perspective of the end user.
Mirage is an API mocking library I maintain that recently became framework-agnostic. It pairs perfectly with TL as it keeps implementation details about the network outside of your test suite, and prevents your tests from becoming brittle.
Anyway, I wanted to share Mirage here, in case anyone finds it helpful, and also to hear what other approaches folks are taking to mock out the network when writing UI tests.
Here's a video of me writing some tests with React/Jest/Mirage/Testing Library:
And here's the project's website: https://miragejs.com
Look forward to hearing what you think, and happy testing!
January 31, 2020 at 3:40pm