refactor: migrate legacy wire namespace to wrn
This commit is contained in:
@@ -190,11 +190,11 @@ describe("serviceClient", () => {
|
||||
expect(seenTarget?.service).toBe("billing");
|
||||
});
|
||||
|
||||
test("a wire-level non-retryable failure (e.g. a 403) surfaces at the client as retryable: false", async () => {
|
||||
test("a wrn-level non-retryable failure (e.g. a 403) surfaces at the client as retryable: false", async () => {
|
||||
// RPC_TRANSPORT recomputes to retryable: true from the code alone — that
|
||||
// is correct for a 5xx, but the transport already determined a 403 is
|
||||
// NOT retryable via the bounded status check. The client must pass that
|
||||
// wire value through rather than recompute it from the code.
|
||||
// wrn value through rather than recompute it from the code.
|
||||
const client = serviceClient(billing, {
|
||||
transport: {
|
||||
call: async () => ({
|
||||
|
||||
@@ -151,7 +151,7 @@ describe("subject context token", () => {
|
||||
});
|
||||
await expect(importSubjectContext(token, "billing")).rejects.toThrow();
|
||||
// Same token, wider explicit bound: proves maxAgeSeconds is actually
|
||||
// wired through rather than the guard being a hardcoded rejection.
|
||||
// connected through rather than the guard being a hardcoded rejection.
|
||||
await expect(
|
||||
importSubjectContext(token, "billing", { maxAgeSeconds: 1000 }),
|
||||
).resolves.toBeDefined();
|
||||
|
||||
@@ -30,7 +30,7 @@ const billing = defineService({
|
||||
},
|
||||
});
|
||||
|
||||
function wire(allowed: boolean) {
|
||||
function wrn(allowed: boolean) {
|
||||
const service = implement(
|
||||
billing,
|
||||
{
|
||||
@@ -47,7 +47,7 @@ function wire(allowed: boolean) {
|
||||
});
|
||||
}
|
||||
|
||||
function httpWire(allowed: boolean) {
|
||||
function createHttpTransport(allowed: boolean) {
|
||||
const service = implement(
|
||||
billing,
|
||||
{
|
||||
@@ -122,7 +122,7 @@ describe("RPC integration", () => {
|
||||
const client = serviceClient(billing, {
|
||||
app: "billing",
|
||||
as: { user: { id: "u1" }, tenant: { id: "acme" }, locals: {} } as unknown as Context,
|
||||
transport: wire(true),
|
||||
transport: wrn(true),
|
||||
});
|
||||
expect(await client.createInvoice({ amountCents: 250 })).toEqual({
|
||||
invoiceId: "inv_250",
|
||||
@@ -136,7 +136,7 @@ describe("RPC integration", () => {
|
||||
const client = serviceClient(billing, {
|
||||
app: "billing",
|
||||
as: { user: { id: "u1" }, locals: {} } as unknown as Context,
|
||||
transport: wire(false),
|
||||
transport: wrn(false),
|
||||
});
|
||||
await expect(client.createInvoice({ amountCents: 1 })).rejects.toMatchObject({
|
||||
code: RPC_ERROR_CODES.denied,
|
||||
@@ -149,7 +149,7 @@ describe("RPC integration", () => {
|
||||
const client = serviceClient(billing, {
|
||||
app: "billing",
|
||||
as: { user: { id: "u1" }, locals: {} } as unknown as Context,
|
||||
transport: httpWire(true),
|
||||
transport: createHttpTransport(true),
|
||||
});
|
||||
expect(await client.createInvoice({ amountCents: 7 })).toEqual({
|
||||
invoiceId: "inv_7",
|
||||
|
||||
Reference in New Issue
Block a user