瀏覽代碼

add user not found test

ryoji-s 3 年之前
父節點
當前提交
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;