Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/action/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { toSatoshis, parseSat } from '../helper';
import * as log from './log';

class ChannelAction {
constructor(store, grpc, nav, notification) {
constructor(store, grpc, transaction, nav, notification) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity - what's the logic behind adding a new param in the middle of existing ones rather than to the end? Also, in case of 2+ args I'm a proponent of passing in an object so that the ordering does not matter.

this._store = store;
this._grpc = grpc;
this._transaction = transaction;
this._nav = nav;
this._notification = notification;
}
Expand Down Expand Up @@ -83,6 +84,7 @@ class ChannelAction {
this.getPeers(),
this.getChannels(),
this.getPendingChannels(),
this._transaction.update(),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const grpc = new GrpcAction(store, ipc);
export const notify = new NotificationAction(store, nav);
export const wallet = new WalletAction(store, grpc, db, nav, notify);
export const info = new InfoAction(store, grpc, nav, notify);
export const channel = new ChannelAction(store, grpc, nav, notify);
export const transaction = new TransactionAction(store, grpc, wallet, nav);
export const channel = new ChannelAction(store, grpc, transaction, nav, notify);
export const invoice = new InvoiceAction(
store,
grpc,
Expand Down
2 changes: 1 addition & 1 deletion stories/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const payment = new PaymentAction(store, grpc, transaction, nav, notify);
sinon.stub(payment, 'checkType');
sinon.stub(payment, 'payBitcoin');
sinon.stub(payment, 'payLightning');
const channel = new ChannelAction(store, grpc, nav, notify);
const channel = new ChannelAction(store, grpc, transaction, nav, notify);
sinon.stub(channel, 'update');
sinon.stub(channel, 'connectAndOpen');
sinon.stub(channel, 'closeSelectedChannel');
Expand Down
4 changes: 2 additions & 2 deletions test/integration/action/action-integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ describe('Action Integration Tests', function() {
grpc1 = new GrpcAction(store1, ipc1);
info1 = new InfoAction(store1, grpc1, nav1, notify1);
wallet1 = new WalletAction(store1, grpc1, db1, nav1, notify1);
channels1 = new ChannelAction(store1, grpc1, nav1, notify1);
transactions1 = new TransactionAction(store1, grpc1, wallet1, nav1);
channels1 = new ChannelAction(store1, grpc1, transactions1, nav1, notify1);
invoice1 = new InvoiceAction(store1, grpc1, transactions1, nav1, notify1);
payments1 = new PaymentAction(store1, grpc1, transactions1, nav1, notify1);

Expand All @@ -163,8 +163,8 @@ describe('Action Integration Tests', function() {
grpc2 = new GrpcAction(store2, ipc2);
info2 = new InfoAction(store2, grpc2, nav2, notify2);
wallet2 = new WalletAction(store2, grpc2, db2, nav2, notify2);
channels2 = new ChannelAction(store2, grpc2, nav2, notify2);
transactions2 = new TransactionAction(store2, grpc2, wallet2, nav2);
channels2 = new ChannelAction(store2, grpc2, transactions2, nav2, notify2);
invoice2 = new InvoiceAction(store2, grpc2, transactions2, nav2, notify2);
payments2 = new PaymentAction(store2, grpc2, transactions2, nav2, notify2);
});
Expand Down
6 changes: 5 additions & 1 deletion test/unit/action/channel.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Store } from '../../../src/store';
import GrpcAction from '../../../src/action/grpc';
import ChannelAction from '../../../src/action/channel';
import TransactionAction from '../../../src/action/transaction';
import NotificationAction from '../../../src/action/notification';
import NavAction from '../../../src/action/nav';
import * as logger from '../../../src/action/log';
Expand All @@ -15,6 +16,7 @@ describe('Action Channels Unit Tests', () => {
let grpc;
let channel;
let nav;
let transaction;
let notification;

beforeEach(() => {
Expand All @@ -24,9 +26,10 @@ describe('Action Channels Unit Tests', () => {
store.settings.displayFiat = false;
require('../../../src/config').RETRY_DELAY = 1;
grpc = sinon.createStubInstance(GrpcAction);
transaction = sinon.createStubInstance(TransactionAction);
notification = sinon.createStubInstance(NotificationAction);
nav = sinon.createStubInstance(NavAction);
channel = new ChannelAction(store, grpc, nav, notification);
channel = new ChannelAction(store, grpc, transaction, nav, notification);
});

afterEach(() => {
Expand Down Expand Up @@ -82,6 +85,7 @@ describe('Action Channels Unit Tests', () => {
it('should refresh channels and peers', async () => {
await channel.update();
expect(grpc.sendCommand, 'was called thrice');
expect(transaction.update, 'was called once');
});
});

Expand Down