the beginning of the idiots
This commit is contained in:
36
qwen/nodejs/tests/app.test.js
Normal file
36
qwen/nodejs/tests/app.test.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// tests/app.test.js
|
||||
const request = require('supertest');
|
||||
const app = require('../index');
|
||||
|
||||
describe('Main Application Routes', () => {
|
||||
test('GET / should return welcome message', async () => {
|
||||
const response = await request(app)
|
||||
.get('/')
|
||||
.expect(200);
|
||||
|
||||
expect(response.body).toHaveProperty('message');
|
||||
expect(response.body.message).toBe('Welcome to MerchantsOfHope.org - TSYS Group Recruiting Platform');
|
||||
expect(response.body).toHaveProperty('status');
|
||||
expect(response.body.status).toBe('running');
|
||||
});
|
||||
|
||||
test('GET /health should return health status', async () => {
|
||||
const response = await request(app)
|
||||
.get('/health')
|
||||
.expect(200);
|
||||
|
||||
expect(response.body).toHaveProperty('status');
|
||||
expect(response.body.status).toBe('OK');
|
||||
expect(response.body).toHaveProperty('service');
|
||||
expect(response.body.service).toBe('MOH Portal API');
|
||||
});
|
||||
|
||||
test('GET /nonexistent should return 404', async () => {
|
||||
const response = await request(app)
|
||||
.get('/nonexistent')
|
||||
.expect(404);
|
||||
|
||||
expect(response.body).toHaveProperty('error');
|
||||
expect(response.body.error).toBe('Route not found');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user