Check out a free preview of the full Complete Intro to React, v3 (feat. Redux, Router & Flow) course:
The "Q&A: Tests and Databases" Lesson is part of the full, Complete Intro to React, v3 (feat. Redux, Router & Flow) course featured in this preview video. Here's what you'd learn in this lesson:

Brian answers questions from students about tests and reading data from databases.

Get Unlimited Access Now

Transcript from the "Q&A: Tests and Databases" Lesson

[00:00:00]
>> Speaker 1: What would you do to manage database content updates that might break the code or break the test?
>> Brian Holt: Well, your test should never be reading directly from the database. That's a big code smell right there that if you're testing that integration, that's too much, that's too much death to your test.

[00:00:18] So with Redux, what you're gonna do is you're going to grab what a database response looks like. And then you're going to pass that in as the action, and then you'll test that. And then you're probably gonna wanna have some sort of integration test that tests your whole app top to bottom, right.

[00:00:35] Maybe that's Selenium, maybe that's I don't know something else. And you should also have server side tests that would catch regressions in terms of like the shape of your API responses on the server side. So yeah, there should be several layers of testing that should catch that, so that's not necessary to test here.

[00:00:56] I think that's the answer to that, or at least that's what I would do.