X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/00ddf216e1a5046a858b1c8b49f0e967404474ca..966327f2b890a5c2ecb63d4d7e81d0ac30b6c750:/src/views-components/search-bar/search-bar-view.test.tsx

diff --git a/src/views-components/search-bar/search-bar-view.test.tsx b/src/views-components/search-bar/search-bar-view.test.tsx
index 843374b9..4230aa80 100644
--- a/src/views-components/search-bar/search-bar-view.test.tsx
+++ b/src/views-components/search-bar/search-bar-view.test.tsx
@@ -46,7 +46,7 @@ describe("<SearchBar />", () => {
             const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
             searchBar.find("form").simulate("submit");
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).toHaveBeenCalledTimes(1);
             expect(onSearch).toBeCalledWith("current value");
         });
@@ -58,37 +58,37 @@ describe("<SearchBar />", () => {
             const searchBar = mount(<SearchBarView value="" onSearch={onSearch} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
             expect(onSearch).not.toBeCalled();
-            jest.advanceTimersByTime(DEFAULT_SEARCH_DEBOUNCE);
+            jest.runTimersToTime(DEFAULT_SEARCH_DEBOUNCE);
             expect(onSearch).toBeCalledWith("current value");
         });
 
         it("calls onSearch after the time specified in props has passed", () => {
             const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={2000} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).not.toBeCalled();
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).toBeCalledWith("current value");
         });
 
         it("calls onSearch only once after no change happened during the specified time", () => {
             const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
-            jest.advanceTimersByTime(500);
+            jest.runTimersToTime(500);
             searchBar.find("input").simulate("change", { target: { value: "changed value" } });
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).toHaveBeenCalledTimes(1);
         });
 
         it("calls onSearch again after the specified time has passed since previous call", () => {
             const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
-            jest.advanceTimersByTime(500);
+            jest.runTimersToTime(500);
             searchBar.find("input").simulate("change", { target: { value: "intermediate value" } });
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).toBeCalledWith("intermediate value");
             searchBar.find("input").simulate("change", { target: { value: "latest value" } });
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).toBeCalledWith("latest value");
             expect(onSearch).toHaveBeenCalledTimes(2);
 
