ryoji-s 2 лет назад
Родитель
Сommit
08c0b7ea8f
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      apps/app/test/unit/middlewares/exclude-read-only-user.test.ts

+ 9 - 0
apps/app/test/unit/middlewares/exclude-read-only-user.test.ts

@@ -17,6 +17,15 @@ describe('excludeReadOnlyUser', () => {
     next = jest.fn();
   });
 
+  test('should call next if user is not found', () => {
+    req.user = null;
+
+    excludeReadOnlyUser(req, res, next);
+
+    expect(next).toBeCalled();
+    expect(res.apiv3Err).not.toBeCalled();
+  });
+
   test('should call next if user is not read only', () => {
     req.user.readOnly = false;