X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/5fd5db805554d3eddd46cc911a5108fbb74b3cfc..2563eaaa00e5ffb77981fbb8cc1bdd37fb2a3ca6:/src/components/search-input/search-input.test.tsx?ds=sidebyside

diff --git a/src/components/search-input/search-input.test.tsx b/src/components/search-input/search-input.test.tsx
index b07445a5..a983a409 100644
--- a/src/components/search-input/search-input.test.tsx
+++ b/src/components/search-input/search-input.test.tsx
@@ -4,7 +4,7 @@
 
 import * as React from "react";
 import { mount, configure } from "enzyme";
-import SearchInput, { DEFAULT_SEARCH_DEBOUNCE } from "./search-input";
+import { SearchInput, DEFAULT_SEARCH_DEBOUNCE } from "./search-input";
 
 import * as Adapter from 'enzyme-adapter-react-16';
 
@@ -46,7 +46,7 @@ describe("<SearchInput />", () => {
             const searchInput = mount(<SearchInput value="" onSearch={onSearch} debounce={1000} />);
             searchInput.find("input").simulate("change", { target: { value: "current value" } });
             searchInput.find("form").simulate("submit");
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).toHaveBeenCalledTimes(1);
             expect(onSearch).toBeCalledWith("current value");
         });
@@ -58,42 +58,42 @@ describe("<SearchInput />", () => {
             const searchInput = mount(<SearchInput value="" onSearch={onSearch} />);
             searchInput.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 searchInput = mount(<SearchInput value="" onSearch={onSearch} debounce={2000}/>);
             searchInput.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 searchInput = mount(<SearchInput value="" onSearch={onSearch} debounce={1000}/>);
             searchInput.find("input").simulate("change", { target: { value: "current value" } });
-            jest.advanceTimersByTime(500);
+            jest.runTimersToTime(500);
             searchInput.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 searchInput = mount(<SearchInput value="" onSearch={onSearch} debounce={1000}/>);
             searchInput.find("input").simulate("change", { target: { value: "current value" } });
-            jest.advanceTimersByTime(500);
+            jest.runTimersToTime(500);
             searchInput.find("input").simulate("change", { target: { value: "intermediate value" } });
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).toBeCalledWith("intermediate value");
             searchInput.find("input").simulate("change", { target: { value: "latest value" } });
-            jest.advanceTimersByTime(1000);
+            jest.runTimersToTime(1000);
             expect(onSearch).toBeCalledWith("latest value");
             expect(onSearch).toHaveBeenCalledTimes(2);
-            
+
         });
 
     });
 
-});
\ No newline at end of file
+});
