Browse Source

Properly mock timeout and interval functions

Kirk Trombley 4 năm trước cách đây
mục cha
commit
07412ae378
1 tập tin đã thay đổi với 7 bổ sung1 xóa
  1. 7 1
      client/src/setupTests.js

+ 7 - 1
client/src/setupTests.js

@@ -23,4 +23,10 @@ global.window = {
   location: {
     href: "http://test-url-base/",
   }
-}
+}
+
+global.setTimeout = jest.fn();
+global.clearTimeout = jest.fn();
+
+global.setInterval = jest.fn();
+global.clearInterval = jest.fn();