bloom-housing / bloom

Bloom is Exygy’s affordable housing platform. Bloom's goal is to be a single entry point for affordable housing seekers and a hub for application and listing management for developers.
https://bloomhousing.com
Apache License 2.0
33 stars 26 forks source link

fix: remove env variable dependencies from tests #4471

Closed ludtkemorgan closed 1 week ago

ludtkemorgan commented 2 weeks ago

This PR addresses #4419

Description

When setting up the circle-ci for the new forked Detroit repo I noticed there was a heavy reliance on environment variables in order to work.

This PR does the following:

How Can This Be Tested/Reviewed?

This is hard to show that it works locally and also the circle-ci run of this PR will still have all of the previously saved environment variables.

I tested this by creating a PR in bloom-detroit and didn't add any env variables to the circle-ci UI. https://github.com/bloom-housing/bloom-detroit/pull/1

Author Checklist:

Review Process:

netlify[bot] commented 2 weeks ago

Deploy Preview for partners-bloom-dev ready!

Name Link
Latest commit 334852b2ea1a442f2f71caf97a8904b4fdb1fdea
Latest deploy log https://app.netlify.com/sites/partners-bloom-dev/deploys/67365e4337140b00085d0d19
Deploy Preview https://deploy-preview-4471--partners-bloom-dev.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 2 weeks ago

Deploy Preview for bloom-exygy-dev ready!

Name Link
Latest commit 334852b2ea1a442f2f71caf97a8904b4fdb1fdea
Latest deploy log https://app.netlify.com/sites/bloom-exygy-dev/deploys/67365e43860ac80008cc610c
Deploy Preview https://deploy-preview-4471--bloom-exygy-dev.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

jaredcwhite commented 1 week ago

@ludtkemorgan It does seem surprising to me to see references to setting environment variables within individual tests. I understand having a set of explicit variables set somewhere in a test environment as it boots up, but I think it feels fragile to be referencing env vars at all in the code of unit tests.

ludtkemorgan commented 1 week ago

@jaredcwhite If you run the tests locally right now it expects your local .env file to contain the appropriate variables. So if you are missing some (or in some cases have the wrong value) the tests would fail locally.

This PR does a few things:

As for your question about unit tests, my thought was this makes it less flaky since it will be the same in all environments - locally and deployed. Also it gives us the benefit of testing scenarios where the environment variable is something different.

We can talk about this more in standup or a eng workshop