From e0d5b11bab341a9be1b79e016aa2215295db03ca Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 25 Aug 2022 14:49:39 -0600 Subject: [PATCH] Add a larger buffer to useLatestResult's test (#9178) Should fix https://github.com/vector-im/element-web/issues/23014 With only a 5ms buffer previously it was possible for Jest to get overwhelmed with the 1500 tests it needs to run. We raise this to 20ms to give extra time to settle. Even with the high sleep times this won't be the longest running test, so should be fine. Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- test/hooks/useLatestResult-test.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/hooks/useLatestResult-test.tsx b/test/hooks/useLatestResult-test.tsx index f5ea67e920..f4c9280e39 100644 --- a/test/hooks/useLatestResult-test.tsx +++ b/test/hooks/useLatestResult-test.tsx @@ -40,26 +40,26 @@ function LatestResultsComponent({ query, doRequest }) { describe("useLatestResult", () => { it("should return results", async () => { const doRequest = async (query) => { - await sleep(20); + await sleep(180); return query; }; const wrapper = mount(); await act(async () => { - await sleep(25); + await sleep(100); }); expect(wrapper.text()).toEqual("0"); wrapper.setProps({ doRequest, query: 1 }); await act(async () => { - await sleep(10); + await sleep(70); }); wrapper.setProps({ doRequest, query: 2 }); await act(async () => { - await sleep(10); + await sleep(70); }); expect(wrapper.text()).toEqual("0"); await act(async () => { - await sleep(15); + await sleep(120); }); expect(wrapper.text()).toEqual("2"); });