UNPKG

myex-cli

Version:

Opinionated Express.js framework with CLI tools

20 lines (16 loc) 639 B
import { jest } from '@jest/globals'; import request from 'supertest'; // Mock database connection jest.unstable_mockModule('../src/db/connection.js', () => ({ connectToDatabase: jest.fn().mockResolvedValue(true), })); // Import the app after mocking dependencies const { default: app } = await import('../src/app.js'); describe('Health Check', () => { test('GET /health should return 200 status and UP message', async () => { const response = await request(app).get('/health'); expect(response.status).toBe(200); expect(response.body.status).toBe('UP'); expect(response.body.timestamp).toBeDefined(); }); });