فهرست منبع

add user not found test

ryoji-s 2 سال پیش
والد
کامیت
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;