try to commit

This commit is contained in:
2026-07-14 12:34:40 +08:00
parent 17755fce7e
commit a7a72096a5
6 changed files with 167 additions and 61 deletions
+5 -5
View File
@@ -6,8 +6,8 @@ process.env.DB_PORT = '5432';
process.env.S3_ENDPOINT = 'http://test-s3:3900';
process.env.S3_PUBLIC_URL = 'https://cdn.example.com';
process.env.S3_BUCKET = 'test-bucket';
process.env.SMTP_HOST = 'smtp.test.com';
process.env.SMTP_PORT = '587';
process.env.GOOGLE_CLIENT_ID = 'test-client-id';
process.env.GMAIL_REFRESH_TOKEN = 'test-refresh-token';
process.env.REDIS_URL = 'redis://127.0.0.1:6379';
// ── Mock all infrastructure before the service module loads ───────────────────
@@ -19,7 +19,7 @@ jest.mock('../../services/email.service', () => ({ ping: jest.fn() }));
const db = require('../../config/db.config');
const cache = require('../../config/redis.config');
const { ping: s3 } = require('../../services/s3.service');
const { ping: smtp } = require('../../services/email.service');
const { ping: smtp } = require('../../services/email.service'); // alias kept for test-body brevity; JSON key is now "email"
const { runDashboard, runReadiness } = require('../../services/health.service');
// ── Reset mocks between tests ─────────────────────────────────────────────────
@@ -184,10 +184,10 @@ describe('runReadiness()', () => {
expect(body).toHaveProperty('memory');
});
test('checks object has database, cache, storage, smtp keys', async () => {
test('checks object has database, cache, storage, email keys', async () => {
allHealthy();
const { body } = await runReadiness();
['database', 'cache', 'storage', 'smtp'].forEach((key) => {
['database', 'cache', 'storage', 'email'].forEach((key) => {
expect(body.checks).toHaveProperty(key);
});
});