move API protection check into hooks, adjusting corresponding tests
This commit is contained in:
@@ -16,21 +16,6 @@ vi.mock('bcrypt', () => ({
|
||||
}));
|
||||
|
||||
describe('API-Endpoint: Users', () => {
|
||||
test('Unerlaubter Zugriff', async () => {
|
||||
const event = {
|
||||
locals: {
|
||||
user: null
|
||||
}
|
||||
};
|
||||
|
||||
const response = await GET(event);
|
||||
expect(response.status).toBe(401);
|
||||
|
||||
const errorMessage = { error: 'Unauthorized' };
|
||||
const json = await response.json();
|
||||
expect(json).toEqual(errorMessage);
|
||||
});
|
||||
|
||||
// [INFO] Test auf keine User nicht notwendig, da immer min. ein User vorhanden
|
||||
|
||||
// Mock eingelogter User bzw. stelle locals.user zur Verfügung
|
||||
|
||||
Reference in New Issue
Block a user