From e34bed7cab015a29d3eb277beecf81b22d33981c Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Wed, 2 Oct 2024 05:12:41 +0000 Subject: [PATCH] test(async-flow): add a test for equate bug --- packages/async-flow/test/endowments.test.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/async-flow/test/endowments.test.js b/packages/async-flow/test/endowments.test.js index f9df904fb60..d047b534aa0 100644 --- a/packages/async-flow/test/endowments.test.js +++ b/packages/async-flow/test/endowments.test.js @@ -85,7 +85,16 @@ const testEndowmentPlay = async (t, zone, gen, isDurable) => { t.is(endowment.state[`${gen}_foo`], `${gen} foo`); t.is(wrapped.state.get(`${gen}_foo`), `${gen} foo`); - const makeBijection = prepareBijection(zone, unwrap); + const guestWrappers = new Map(); + const unwrapSpy = (hostWrapped, guestWrapped) => { + const unwrapped = unwrap(hostWrapped, guestWrapped); + if (unwrapped !== guestWrapped) { + guestWrappers.set(hostWrapped, guestWrapped); + } + return unwrapped; + }; + + const makeBijection = prepareBijection(zone, unwrapSpy); const bij = zone.makeOnce('bij', makeBijection); const makeGuestForHostRemotable = hRem => { @@ -129,6 +138,9 @@ const testEndowmentPlay = async (t, zone, gen, isDurable) => { const { state: _2, ...passableWrapped } = wrapped; t.notThrows(() => equate(harden(passableUnwrapped), harden(passableWrapped))); + for (const [hostWrapped, guestWrapped] of guestWrappers) { + t.notThrows(() => equate(guestWrapped, hostWrapped)); + } }; const testEndowmentBadReplay = async (_t, _zone, _gen, _isDurable) => {