Skip to content

Commit

Permalink
test(async-flow): add a test for equate bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Oct 4, 2024
1 parent 1edbcee commit e34bed7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/async-flow/test/endowments.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit e34bed7

Please sign in to comment.