Skip to content

Commit 000f664

Browse files
test(home): cover isSet edge cases (empty, whitespace, missing JWT)
1 parent 12a0e0e commit 000f664

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

modules/home/tests/home.integration.tests.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,29 @@ describe('Home integration tests:', () => {
296296
config.oAuth = origOAuth;
297297
});
298298

299+
test('should report warning when config values are empty strings or whitespace', async () => {
300+
const origDomain = config.domain;
301+
const origStripe = config.stripe;
302+
config.domain = ' ';
303+
config.stripe = { secretKey: '' };
304+
const result = await agent.get('/api/admin/readiness').set('Cookie', `TOKEN=${adminToken}`).expect(200);
305+
const cfgCheck = result.body.data.find((c) => c.category === 'config');
306+
const billingCheck = result.body.data.find((c) => c.category === 'billing');
307+
expect(cfgCheck.status).toBe('warning');
308+
expect(billingCheck.status).toBe('warning');
309+
config.domain = origDomain;
310+
config.stripe = origStripe;
311+
});
312+
313+
test('should report warning when JWT secret is empty', async () => {
314+
const origJwt = config.jwt.secret;
315+
config.jwt.secret = '';
316+
const result = await agent.get('/api/admin/readiness').set('Cookie', `TOKEN=${adminToken}`).expect(200);
317+
const secCheck = result.body.data.find((c) => c.category === 'security');
318+
expect(secCheck.status).toBe('warning');
319+
config.jwt.secret = origJwt;
320+
});
321+
299322
test('should return 422 when readiness service throws', async () => {
300323
jest.spyOn(HomeService, 'getReadinessStatus').mockImplementationOnce(() => {
301324
throw new Error('config error');

0 commit comments

Comments
 (0)