()
| 33 | |
| 34 | describe("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 | ); |
no test coverage detected