[ARVADOS-WORKBENCH2] updated: 1.2.0-559-g966327f
Git user
git at public.curoverse.com
Mon Oct 8 04:11:22 EDT 2018
Summary of changes:
src/components/search-input/search-input.test.tsx | 18 +++++++++---------
.../search-bar/search-bar-view.test.tsx | 18 +++++++++---------
2 files changed, 18 insertions(+), 18 deletions(-)
via 966327f2b890a5c2ecb63d4d7e81d0ac30b6c750 (commit)
from 00ddf216e1a5046a858b1c8b49f0e967404474ca (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 966327f2b890a5c2ecb63d4d7e81d0ac30b6c750
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Mon Oct 8 10:11:09 2018 +0200
tests fix
Feature #14275
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/components/search-input/search-input.test.tsx b/src/components/search-input/search-input.test.tsx
index a91f9b1..a983a40 100644
--- a/src/components/search-input/search-input.test.tsx
+++ b/src/components/search-input/search-input.test.tsx
@@ -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,37 +58,37 @@ 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);
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 843374b..4230aa8 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);
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list