Explorar o código

add user not found test

ryoji-s %!s(int64=2) %!d(string=hai) anos
pai
achega
08c0b7ea8f

+ 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;