0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-26 18:12:40 +00:00

Add tests for lock API functions

This commit is contained in:
G.Ambatte
2025-04-10 19:15:34 +12:00
parent 73bb6acc14
commit 0c33df1cd6
3 changed files with 591 additions and 3 deletions

View File

@@ -232,7 +232,7 @@ router.post('/api/lock/:id', mw.adminOnly, asyncHandler(async (req, res)=>{
await brew.save()
.catch((error)=>{
throw { name: 'Already Locked', message: 'Unable to set lock', shareId: req.params.id, status: 500, HBErrorCode: '62', error };
throw { name: 'Lock Error', message: 'Unable to set lock', shareId: req.params.id, status: 500, HBErrorCode: '62', error };
});
return res.json({ name: 'LOCKED', message: `Lock applied to brew ID ${brew.shareId} - ${brew.title}`, ...lock });
@@ -289,7 +289,7 @@ router.get('/api/lock/reviews', mw.adminOnly, asyncHandler(async (req, res)=>{
}));
router.put('/admin/lock/review/request/:id', asyncHandler(async (req, res)=>{
router.put('/api/lock/review/request/:id', asyncHandler(async (req, res)=>{
// === This route is NOT Admin only ===
// Any user can request a review of their document
const filter = {