14 lines
No EOL
515 B
JavaScript
14 lines
No EOL
515 B
JavaScript
const request = require('supertest');
|
|
const app = require('../src/server.js');
|
|
|
|
describe('Role Middleware Tests', () => {
|
|
test('should allow access to public route without authentication', async () => {
|
|
const response = await request(app).get('/health');
|
|
expect(response.status).toBe(200);
|
|
});
|
|
|
|
test('should deny access to protected route without authentication', async () => {
|
|
const response = await request(app).get('/test-role');
|
|
expect(response.status).toBe(401); // Unauthorized
|
|
});
|
|
}); |