Mock LND gRPC Object for unit testing Lightning Network applications. Current version: 4.0.0 (requires Node >=22). Provides factory functions to create mock LND gRPC responses for invoices, forwards, payments, subscriptions, and more. Designed to simulate the authenticated LND API object returned by `ln-service`, enabling isolated unit tests without a real LND node. Provides overrides for key LND methods like `getChannels`, `getForwards`, `subscribeToInvoice`, and `payViaRoutes`. No external runtime dependencies.
npm install mock-lndNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: create a mock lnd object with overrides for getForwards and getInvoice, then test behavior.
Upgrade Node.js to v22 or later.
Use the overrides object directly as the argument to `makeLnd`.
Pass an object with `is_unknown_failure` instead of a boolean.
Always override the methods you intend to use in tests.
Add `getInfo: () => Promise.resolve({})` to the overrides object passed to `makeLnd`.Switch to dynamic import: `const { makeInvoice } = await import('mock-lnd')` or configure package.json with `"type": "module"`.