Skip to content

Commit 4b13a81

Browse files
ShahanaFarooquicdecker
authored andcommitted
gl-sdk-napi: Update testing instructions in README
Closes #677
1 parent e0552d3 commit 4b13a81

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

libs/gl-sdk-napi/README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,42 @@ quickStart();
238238
| `label` | `string` | Label assigned to the invoice |
239239
| `amountMsat` | `number` | Amount received in millisatoshis |
240240

241-
## Development
241+
## Testing
242242

243-
### Running Tests
243+
The test setup starts and stops all required infrastructure automatically.
244+
245+
### Running the Tests
244246

245247
```bash
248+
# Run all tests
246249
npm test
250+
251+
# Run with verbose infrastructure logs
252+
VERBOSE=1 npm test
253+
254+
# Run a specific test file
255+
npm test -- --verbose tests/node.spec.ts
247256
```
248257

249-
### Local npm Publishing
258+
### How It Works
259+
260+
The global setup script `./tests/jest.globalSetup.ts` automatically:
261+
- Starts `test_setup.py`, spinning up bitcoind, the Greenlight scheduler, and an LSPS2-compatible LSP node
262+
- Waits for all services to be ready
263+
- Injects the required environment variables (`GL_SCHEDULER_GRPC_URI`, `GL_CA_CRT`, `GL_NOBODY_CRT`, `GL_NOBODY_KEY`, `LSP_RPC_SOCKET`, `LSP_NODE_ID`, `LSP_PROMISE_SECRET`, `GL_FUND_SERVER`)
264+
- Shuts everything down after all tests complete
265+
266+
### Test Helpers
267+
268+
`test.helper.ts` provides utilities for interacting with the running infrastructure:
269+
270+
| Function | Description |
271+
|----------|-------------|
272+
| `fundNode(node, amountSats?)` | Funds a test node with on-chain Bitcoin, waiting until the node detects the confirmed UTXO |
273+
| `lspInfo()` | Returns the LSP node's RPC socket, node ID, and promise secret |
274+
275+
276+
## Local npm Publishing
250277
This workflow only builds for local platform. For multi-platform builds, use the GitHub Actions workflow which cross-compiles for all supported targets.
251278

252279
```bash

0 commit comments

Comments
 (0)