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');
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										11
									
								
								qwen/nodejs/tests/setup.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								qwen/nodejs/tests/setup.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
// tests/setup.js
 | 
			
		||||
// Setup file for Jest tests
 | 
			
		||||
 | 
			
		||||
// Mock environment variables
 | 
			
		||||
process.env.JWT_SECRET = 'test_secret';
 | 
			
		||||
process.env.DB_HOST = 'localhost';
 | 
			
		||||
process.env.DB_USER = 'test_user';
 | 
			
		||||
process.env.DB_PASSWORD = 'test_password';
 | 
			
		||||
process.env.DB_NAME = 'test_db';
 | 
			
		||||
 | 
			
		||||
console.log('Jest test environment setup complete');
 | 
			
		||||
		Reference in New Issue
	
	Block a user