forked from lnp2pBot/bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlightning_test.js
More file actions
23 lines (21 loc) · 881 Bytes
/
Copy pathlightning_test.js
File metadata and controls
23 lines (21 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const sinon = require('sinon');
const { expect } = require('chai');
const lightning = require('lightning');
const { parsePaymentRequest } = require('invoices');
const { createHodlInvoiceResponse } = require('./lightningResponse');
const { createHoldInvoice } = require('../ln');
describe('Testing lighting network', () => {
it('Should create hold invoice', async () => {
// We spy on the lighting service call
const stub = sinon.stub(lightning, 'createHodlInvoice');
// Then we test our internal lightning call
stub.returns(createHodlInvoiceResponse);
const { hash, request } = await createHoldInvoice({
description: 'Holis',
amount: 200,
});
const invoice = parsePaymentRequest({ request });
expect(hash).to.be.equal(createHodlInvoiceResponse.id);
expect(invoice.tokens).to.be.equal(createHodlInvoiceResponse.tokens);
});
});