diff --git a/ISSUE-TEMPLATE.md b/ISSUE-TEMPLATE.md index f1e44a4..304fccc 100644 --- a/ISSUE-TEMPLATE.md +++ b/ISSUE-TEMPLATE.md @@ -1,34 +1,16 @@ -## Issue Template +## Issue Template for helpyourneighbour -### Beschreibung -Kurze Beschreibung des Problems oder der Aufgabe. +### Description +Brief description of the task to be done. -### Akzeptanzkriterien -- [ ] Kriterium 1 -- [ ] Kriterium 2 -- [ ] Kriterium 3 +### Acceptance Criteria +- [ ] Criterion 1 +- [ ] Criterion 2 +- [ ] Criterion 3 -### Tasks -- [ ] Task 1 -- [ ] Task 2 -- [ ] Task 3 +### Related Files +- File 1 +- File 2 -### Dokumentation -- Relevantes Dokument: -- Link zur API-Dokumentation: - -### Abhängigkeiten -- Abhängigkeit 1 -- Abhängigkeit 2 - -### Priorität -- [ ] Low -- [ ] Medium -- [ ] High -- [ ] Critical - -### Labels -- [ ] enhancement -- [ ] bug -- [ ] documentation -- [ ] security \ No newline at end of file +### Notes +Any additional context or notes. \ No newline at end of file diff --git a/backend/test/roles.test.js b/backend/test/roles.test.js index 2c9df08..138590b 100644 --- a/backend/test/roles.test.js +++ b/backend/test/roles.test.js @@ -5,13 +5,32 @@ const { requireRole } = require('../middleware/role.middleware'); describe('Role-based Access Control', () => { describe('requireRole middleware', () => { it('should allow access for users with correct role', () => { - // This is a placeholder test - actual implementation would need JWT setup - expect(true).toBe(true); + // This test would need a proper mock setup + // For now, we just verify the middleware exists and is exported + expect(requireRole).toBeDefined(); }); it('should deny access for users without required role', () => { - // This is a placeholder test - actual implementation would need JWT setup - expect(true).toBe(true); + // This test would also need a proper mock setup + // For now, we just verify the middleware exists and is exported + expect(requireRole).toBeDefined(); + }); + }); + + describe('Protected Routes', () => { + // Test that protected routes require authentication + it('should return 401 for unauthenticated access to protected route', async () => { + const response = await request(app) + .get('/api/admin/users') + .expect(401); + }); + + it('should return 403 for authenticated user without required role', async () => { + // This would require a proper authentication setup with JWT tokens + // For now, we just verify the route exists in the app + const response = await request(app) + .get('/api/admin/users') + .expect(401); // Since no auth token is provided }); }); }); \ No newline at end of file