Skip to content

test(extension): Simplify capTp tests #54

@grypez

Description

@grypez

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreNot a feature, not documentation, but something we still have to do.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions