Files
2026-10-29 11:57:29 +01:00

26 lines
1.1 KiB
JavaScript

// Generated, do not edit. sha256:e4e79ee7e120dce5fb4b9cab93e8098467cf35f61e34bbbef06650b85960c70d
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
const { testLnd } = await import('../../client/lightning/lnd.js');
function metAntwoord(json, fn) {
const origineel = globalThis.fetch;
globalThis.fetch = async () => new Response(JSON.stringify(json), { status: 200, headers: { 'Content-Type': 'application/json' } });
return Promise.resolve(fn()).finally(() => { globalThis.fetch = origineel; });
}
describe('testLnd', () => {
it('leest alias, synchronisatie en blokhoogte uit het antwoord van LND', async () => {
await metAntwoord({ alias: 'Truman', synced_to_chain: true, block_height: 921334 }, async () => {
assert.deepEqual(await testLnd(3), { alias: 'Truman', synced: true, blockHeight: 921334 });
});
});
it('zonder blokhoogte in het antwoord: 0 en geen fout', async () => {
await metAntwoord({ alias: '', synced_to_chain: false }, async () => {
assert.deepEqual(await testLnd(3), { alias: null, synced: false, blockHeight: 0 });
});
});
});