0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Improved WEBHOOK_SECRET initialization in tests

refs https://github.com/TryGhost/Toolbox/issues/214

- Having to fill out `process.env` variables in tests is a frustrating developer experience. Test environment should be configured with smart defaults, so the developer writing test cases would modify variables like this only is special test cases.
This commit is contained in:
Naz 2022-02-17 20:26:16 +07:00
parent daa39bf4fe
commit 80f0ba4abf
2 changed files with 1 additions and 1 deletions

View file

@ -8,7 +8,6 @@ let adminAgent;
describe('Members API', function () { describe('Members API', function () {
before(async function () { before(async function () {
process.env.WEBHOOK_SECRET = 'pissoff';
// Weird - most of the mocks happen after getting the agent // Weird - most of the mocks happen after getting the agent
// but to mock stripe we want to fake the stripe keys in the settings. // but to mock stripe we want to fake the stripe keys in the settings.
// And it's initialised at boot - so mocking it before // And it's initialised at boot - so mocking it before

View file

@ -1,4 +1,5 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'testing'; process.env.NODE_ENV = process.env.NODE_ENV || 'testing';
process.env.WEBHOOK_SECRET = process.env.WEBHOOK_SECRET || 'TEST_STRIPE_WEBHOOK_SECRET';
require('../../core/server/overrides'); require('../../core/server/overrides');