diff --git a/tests/context.test.ts b/tests/context.test.ts index 5be3b1de..52802ab1 100644 --- a/tests/context.test.ts +++ b/tests/context.test.ts @@ -106,7 +106,7 @@ describe("Context", () => { expect(fixture.innerHTML).toBe("
321321
"); }); - test("two async components on two levels are updated in parallel", async () => { + test("two async components on two levels are updated (mostly) in parallel", async () => { const testContext = new Context({ value: 123 }); const def = makeDeferred(); const steps: string[] = []; @@ -151,6 +151,11 @@ describe("Context", () => { ); def.resolve(); await nextTick(); + // we need to wait for an extra tick because it could happen (even though it + // is rare) that the second batch of renderings is not done yet, because + // the initial promise has been given to the macrotask queue, so a small + // delay happens. + await nextTick(); expect(steps).toEqual(["render", "render", "render"]); expect(fixture.innerHTML).toBe( "

321

321

321

"