Skip to content

Commit 4b410d3

Browse files
authored
fix timing problems in tests introduced by latest React canary (apollographql#12234)
Co-authored-by: phryneas <[email protected]>
1 parent 0a0298f commit 4b410d3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.size-limits.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"dist/apollo-client.min.cjs": 41639,
2+
"dist/apollo-client.min.cjs": 41640,
33
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 34381
44
}

src/react/hooks/__tests__/useSubscription.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { PROTOCOL_ERRORS_SYMBOL } from "../../../errors";
1313
import { InMemoryCache as Cache } from "../../../cache";
1414
import { ApolloProvider } from "../../context";
15-
import { MockSubscriptionLink } from "../../../testing";
15+
import { MockSubscriptionLink, wait } from "../../../testing";
1616
import { useSubscription } from "../useSubscription";
1717
import { spyOnConsole } from "../../../testing/internal";
1818
import { SubscriptionHookOptions } from "../../types/types";
@@ -1961,6 +1961,7 @@ describe("ignoreResults", () => {
19611961
}
19621962
);
19631963
if (!IS_REACT_17) {
1964+
await wait(0);
19641965
expect(subscriptionCreated).toHaveBeenCalledTimes(1);
19651966
}
19661967

@@ -2034,6 +2035,7 @@ describe("ignoreResults", () => {
20342035
}
20352036
);
20362037
if (!IS_REACT_17) {
2038+
await wait(0);
20372039
expect(subscriptionCreated).toHaveBeenCalledTimes(1);
20382040
}
20392041

0 commit comments

Comments
 (0)