mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 05:04:57 +08:00
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>
This commit is contained in:
parent
9b99c967f4
commit
e0d5b11bab
@ -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(<LatestResultsComponent query={0} doRequest={doRequest} />);
|
||||
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");
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user