helpyourneighbour/backend/tests/roles.test.js
BibaBot 76fcfa6e15
Some checks are pending
Docker Test / test (push) Waiting to run
feat: Add role middleware tests and update docs
2026-03-16 22:06:48 +00:00

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
});
});