[arvados] updated: 2.7.0-6609-gf13584987d
git repository hosting
git at public.arvados.org
Mon May 20 16:25:52 UTC 2024
Summary of changes:
.../components/search-input/search-input.test.tsx | 24 +++++++++++-----------
.../auto-logout/auto-logout.test.tsx | 12 +++++------
.../search-bar/search-bar-view.test.tsx | 16 +++++++--------
3 files changed, 26 insertions(+), 26 deletions(-)
via f13584987de14ea9d3080df6ce46f6dec21b8393 (commit)
from 6fdb018495525d90397fbc0e9ebe07f6203201b6 (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 f13584987de14ea9d3080df6ce46f6dec21b8393
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Mon May 20 12:25:45 2024 -0400
21720: changed runTimersToTime to advanceTimersByTime
Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/services/workbench2/src/components/search-input/search-input.test.tsx b/services/workbench2/src/components/search-input/search-input.test.tsx
index 213b46404b..ba0f43d8b5 100644
--- a/services/workbench2/src/components/search-input/search-input.test.tsx
+++ b/services/workbench2/src/components/search-input/search-input.test.tsx
@@ -44,7 +44,7 @@ describe("<SearchInput />", () => {
const searchInput = mount(<SearchInput selfClearProp="" value="" onSearch={onSearch} debounce={1000} />);
searchInput.find("input").simulate("change", { target: { value: "current value" } });
searchInput.find("form").simulate("submit");
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).toHaveBeenCalledTimes(1);
expect(onSearch).toBeCalledWith("current value");
});
@@ -56,37 +56,37 @@ describe("<SearchInput />", () => {
const searchInput = mount(<SearchInput selfClearProp="" value="" onSearch={onSearch} />);
searchInput.find("input").simulate("change", { target: { value: "current value" } });
expect(onSearch).not.toBeCalled();
- jest.runTimersToTime(DEFAULT_SEARCH_DEBOUNCE);
+ jest.advanceTimersByTime(DEFAULT_SEARCH_DEBOUNCE);
expect(onSearch).toBeCalledWith("current value");
});
it("calls onSearch after the time specified in props has passed", () => {
const searchInput = mount(<SearchInput selfClearProp="" value="" onSearch={onSearch} debounce={2000}/>);
searchInput.find("input").simulate("change", { target: { value: "current value" } });
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).not.toBeCalled();
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).toBeCalledWith("current value");
});
it("calls onSearch only once after no change happened during the specified time", () => {
const searchInput = mount(<SearchInput selfClearProp="" value="" onSearch={onSearch} debounce={1000}/>);
searchInput.find("input").simulate("change", { target: { value: "current value" } });
- jest.runTimersToTime(500);
+ jest.advanceTimersByTime(500);
searchInput.find("input").simulate("change", { target: { value: "changed value" } });
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).toHaveBeenCalledTimes(1);
});
it("calls onSearch again after the specified time has passed since previous call", () => {
const searchInput = mount(<SearchInput selfClearProp="" value="" onSearch={onSearch} debounce={1000}/>);
searchInput.find("input").simulate("change", { target: { value: "current value" } });
- jest.runTimersToTime(500);
+ jest.advanceTimersByTime(500);
searchInput.find("input").simulate("change", { target: { value: "intermediate value" } });
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).toBeCalledWith("intermediate value");
searchInput.find("input").simulate("change", { target: { value: "latest value" } });
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).toBeCalledWith("latest value");
expect(onSearch).toHaveBeenCalledTimes(2);
@@ -99,18 +99,18 @@ describe("<SearchInput />", () => {
const searchInput = mount(<SearchInput selfClearProp="abc" value="123" onSearch={onSearch} debounce={1000}/>);
// component should clear value upon creation
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).toBeCalledWith("");
expect(onSearch).toHaveBeenCalledTimes(1);
// component should not clear on same selfClearProp
searchInput.setProps({ selfClearProp: 'abc' });
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).toHaveBeenCalledTimes(1);
// component should clear on selfClearProp change
searchInput.setProps({ selfClearProp: '111' });
- jest.runTimersToTime(1000);
+ jest.advanceTimersByTime(1000);
expect(onSearch).toBeCalledWith("");
expect(onSearch).toHaveBeenCalledTimes(2);
});
diff --git a/services/workbench2/src/views-components/auto-logout/auto-logout.test.tsx b/services/workbench2/src/views-components/auto-logout/auto-logout.test.tsx
index 28084ed1c1..b07e3dccfa 100644
--- a/services/workbench2/src/views-components/auto-logout/auto-logout.test.tsx
+++ b/services/workbench2/src/views-components/auto-logout/auto-logout.test.tsx
@@ -31,28 +31,28 @@ describe('<AutoLogoutComponent />', () => {
});
it('should logout after idle timeout', () => {
- jest.runTimersToTime((sessionIdleTimeout-1)*1000);
+ jest.advanceTimersByTime((sessionIdleTimeout-1)*1000);
expect(props.doLogout).not.toBeCalled();
- jest.runTimersToTime(1*1000);
+ jest.advanceTimersByTime(1*1000);
expect(props.doLogout).toBeCalled();
});
it('should warn the user previous to close the session', () => {
- jest.runTimersToTime((sessionIdleTimeout-lastWarningDuration-1)*1000);
+ jest.advanceTimersByTime((sessionIdleTimeout-lastWarningDuration-1)*1000);
expect(props.doWarn).not.toBeCalled();
- jest.runTimersToTime(1*1000);
+ jest.advanceTimersByTime(1*1000);
expect(props.doWarn).toBeCalled();
});
it('should reset the idle timer when activity event is received', () => {
- jest.runTimersToTime((sessionIdleTimeout-lastWarningDuration-1)*1000);
+ jest.advanceTimersByTime((sessionIdleTimeout-lastWarningDuration-1)*1000);
expect(props.doWarn).not.toBeCalled();
// Simulate activity from other window/tab
eventListeners.storage({
key: LAST_ACTIVE_TIMESTAMP,
newValue: '42' // value currently doesn't matter
})
- jest.runTimersToTime(1*1000);
+ jest.advanceTimersByTime(1*1000);
// Warning should not appear because idle timer was reset
expect(props.doWarn).not.toBeCalled();
});
diff --git a/services/workbench2/src/views-components/search-bar/search-bar-view.test.tsx b/services/workbench2/src/views-components/search-bar/search-bar-view.test.tsx
index 2f7ed6569e..202050076a 100644
--- a/services/workbench2/src/views-components/search-bar/search-bar-view.test.tsx
+++ b/services/workbench2/src/views-components/search-bar/search-bar-view.test.tsx
@@ -29,37 +29,37 @@ describe("<SearchBarView />", () => {
// const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" {...mockSearchProps()} />);
// searchBar.find("input").simulate("change", { target: { value: "current value" } });
// expect(onSearch).not.toBeCalled();
- // jest.runTimersToTime(DEFAULT_SEARCH_DEBOUNCE);
+ // jest.advanceTimersByTime(DEFAULT_SEARCH_DEBOUNCE);
// expect(onSearch).toBeCalledWith("current value");
// });
// it("calls onSearch after the time specified in props has passed", () => {
// const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" debounce={2000} {...mockSearchProps()} />);
// searchBar.find("input").simulate("change", { target: { value: "current value" } });
- // jest.runTimersToTime(1000);
+ // jest.advanceTimersByTime(1000);
// expect(onSearch).not.toBeCalled();
- // jest.runTimersToTime(1000);
+ // jest.advanceTimersByTime(1000);
// expect(onSearch).toBeCalledWith("current value");
// });
// it("calls onSearch only once after no change happened during the specified time", () => {
// const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" debounce={1000} {...mockSearchProps()} />);
// searchBar.find("input").simulate("change", { target: { value: "current value" } });
- // jest.runTimersToTime(500);
+ // jest.advanceTimersByTime(500);
// searchBar.find("input").simulate("change", { target: { value: "changed value" } });
- // jest.runTimersToTime(1000);
+ // jest.advanceTimersByTime(1000);
// expect(onSearch).toHaveBeenCalledTimes(1);
// });
// it("calls onSearch again after the specified time has passed since previous call", () => {
// const searchBar = mount(<SearchBarView onSearch={onSearch} value="latest value" debounce={1000} {...mockSearchProps()} />);
// searchBar.find("input").simulate("change", { target: { value: "current value" } });
- // jest.runTimersToTime(500);
+ // jest.advanceTimersByTime(500);
// searchBar.find("input").simulate("change", { target: { value: "intermediate value" } });
- // jest.runTimersToTime(1000);
+ // jest.advanceTimersByTime(1000);
// expect(onSearch).toBeCalledWith("intermediate value");
// searchBar.find("input").simulate("change", { target: { value: "latest value" } });
- // jest.runTimersToTime(1000);
+ // jest.advanceTimersByTime(1000);
// expect(onSearch).toBeCalledWith("latest value");
// expect(onSearch).toHaveBeenCalledTimes(2);
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list