Skip to content

Connectum API Reference / @connectum/test-fixtures / index / createFakeMethod

Function: createFakeMethod() โ€‹

createFakeMethod(service, name, options?): DescMethod

Defined in: fake-service.ts:72

Create a fake DescMethod descriptor attached to a service.

When options.register is true, the method is pushed into service.methods and added to service.method (keyed by localName). This is required for tests that iterate over service methods (e.g., getPublicMethods()).

Parameters โ€‹

service โ€‹

DescService

The parent DescService (typically from createFakeService).

name โ€‹

string

The RPC method name (PascalCase, e.g. "GetUser").

options? โ€‹

FakeMethodOptions

Optional configuration for method kind and registration.

Returns โ€‹

DescMethod

A fake DescMethod suitable for unit/integration tests.

Example โ€‹

ts
import { createFakeService, createFakeMethod } from "@connectum/testing";

const svc = createFakeService();
const method = createFakeMethod(svc, "GetUser", { register: true });
// method.localName === "getUser"
// svc.methods.length === 1