MCPcopy Create free account
hub / github.com/commandoperator/cmdop-sdk / makeTransport

Function makeTransport

node/tests/transport.test.ts:35–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34describe("v2 transport", () => {
35 it("round-trips unary responses and maps typed errors", async () => {
36 const fixture = setup();
37 const call = fixture.transport.callUnary(
38 create(EnvelopeSchema, { payload: { case: "systemBootstrapReq", value: {} } }),
39 );
40 let req = await request(fixture.requests);
41 fixture.feed(
42 create(EnvelopeSchema, {
43 id: req.id,
44 kind: Envelope_Kind.RESPONSE,
45 payload: { case: "systemBootstrapResp", value: { bundleId: "bundle" } },
46 }),
47 );
48 expect((await call).payload.value).toMatchObject({ bundleId: "bundle" });
49
50 const failed = fixture.transport.callUnary(
51 create(EnvelopeSchema, { payload: { case: "listMachinesReq", value: {} } }),
52 );
53 req = await request(fixture.requests);
54 fixture.feed(
55 create(EnvelopeSchema, {
56 id: req.id,
57 kind: Envelope_Kind.ERROR,
58 payload: { case: "error", value: { code: ErrorCode.UNAUTHENTICATED, message: "missing token" } },
59 }),
60 );

Callers 1

transport.test.tsFile · 0.70

Calls 2

attachStreamsForTestMethod · 0.95
resolveConfigFunction · 0.90

Tested by

no test coverage detected