-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I agree the test is both cumbersome and fragile. Notes toward elegance:
The IframeManager does a good job of protecting its internals. The test is mocked this way because we already have the opportunity to intercept and interfere with the ports underlying the message channel. The manager does not expose its vats, and a vat's capTp instance is a property of the vat.
We could allow interference with @endo/capTp/makeCapTp's rawSend argument by changing the signature of IframeManager.makeCapTp like so.
IframeManager.makeCapTp(id: VatId, makeRawSend?: (writer) => (content: unknown) => Promise<void> )This is a similar approach to how create IframeManager.create accepts an optional getPort.
Or, we could expose a vat's capTp instance by adding IframeManager.getCapTp(id: vatId).
Or, we could move some of this logic to test-utils, but we would still have to maintain some parity with the endo/captp implementation.
Originally posted by @grypez in #43 (comment)