소스 검색

[frontend] Fix missing act() in AlertComponent tests

Johan Åhlén 1 년 전
부모
커밋
d9ae00d22f
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      desktop/core/src/desktop/js/reactComponents/AlertComponent/AlertComponent.test.tsx

+ 6 - 2
desktop/core/src/desktop/js/reactComponents/AlertComponent/AlertComponent.test.tsx

@@ -98,11 +98,15 @@ describe('AlertComponent', () => {
     expect(screen.queryAllByRole('alert')).toHaveLength(1);
 
     //It should still be open after 2 seconds
-    jest.advanceTimersByTime(2000);
+    act(() => {
+      jest.advanceTimersByTime(2000);
+    });
     expect(screen.queryAllByRole('alert')).toHaveLength(1);
 
     //After 3.1 seconds, it should really be closed
-    jest.advanceTimersByTime(1000);
+    act(() => {
+      jest.advanceTimersByTime(1000);
+    });
     expect(screen.queryAllByRole('alert')).toHaveLength(0);
 
     jest.useRealTimers();