Skip to content

Commit a9276d9

Browse files
test(home): cover isSet edge cases (empty, whitespace, missing JWT)
1 parent 33dbccb commit a9276d9

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
@@ -298,6 +298,29 @@ describe('Home integration tests:', () => {
298298
config.oAuth = origOAuth;
299299
});
300300

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

0 commit comments

Comments
 (0)