Skip to content

Commit 089e0e8

Browse files
committed
fix: mocha tests
1 parent 213b26a commit 089e0e8

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

example/tests/eclair.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,13 @@ describe('Eclair', function () {
128128
// network: ldkNetwork(selectedNetwork),
129129
getFees: () => {
130130
return Promise.resolve({
131-
highPriority: 30,
132-
normal: 20,
133-
background: 10,
134-
mempoolMinimum: 5,
131+
onChainSweep: 30,
132+
maxAllowedNonAnchorChannelRemoteFee: Math.max(25, 30 * 10),
133+
minAllowedAnchorChannelRemoteFee: 5,
134+
minAllowedNonAnchorChannelRemoteFee: Math.max(5 - 1, 0),
135+
anchorChannelFee: 10,
136+
nonAnchorChannelFee: 20,
137+
channelCloseMinimum: 5,
135138
});
136139
},
137140
});

example/tests/unit.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ describe('Unit', function () {
5555
hex: '000000205d1f3ece3bcb0a3530adaae2e4aa47f8aad434db95c6cb6d09d5ac99e3f6df4f0a19fe968830a06dcc49c9cca4acc532226e4c30b741802420e0fdd2b092eccdbf95cb64ffff7f2000000000',
5656
}),
5757
account,
58-
getAddress: async () => 'bcrt1qtk89me2ae95dmlp3yfl4q9ynpux8mxjus4s872',
58+
getAddress: async () => ({
59+
address: 'bcrt1qtk89me2ae95dmlp3yfl4q9ynpux8mxjus4s872',
60+
publicKey:
61+
'0298720ece754e377af1b2716256e63c2e2427ff6ebdc66c2071c43ae80132ca32',
62+
}),
5963
getScriptPubKeyHistory: async () => [],
6064
getFees: () => {
6165
return Promise.resolve({

example/tests/utils/test-profile.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as bitcoin from 'bitcoinjs-lib';
55
import { randomBytes } from 'react-native-randombytes';
66
import { Platform } from 'react-native';
77
import {
8+
IAddress,
89
TAccount,
910
TAvailableNetworks,
1011
THeader,
@@ -71,17 +72,26 @@ export default class TestProfile {
7172
getScriptPubKeyHistory: this.getScriptPubKeyHistory,
7273
getFees: () =>
7374
Promise.resolve({
74-
highPriority: 4,
75-
normal: 3,
76-
background: 2,
77-
mempoolMinimum: 1,
75+
onChainSweep: 4,
76+
maxAllowedNonAnchorChannelRemoteFee: Math.max(25, 4 * 10),
77+
minAllowedAnchorChannelRemoteFee: 1,
78+
minAllowedNonAnchorChannelRemoteFee: Math.max(1 - 1, 0),
79+
anchorChannelFee: 2,
80+
nonAnchorChannelFee: 3,
81+
channelCloseMinimum: 1,
7882
}),
7983
getTransactionData: this.getTransactionData,
8084
getTransactionPosition: this.getTransactionPosition,
8185
broadcastTransaction: this.broadcastTransaction,
8286
network: ldkNetwork(this.network),
8387
// forceCloseOnStartup: { forceClose: true, broadcastLatestTx: false },
8488
forceCloseOnStartup: undefined,
89+
// trustedZeroConfPeers: [],
90+
backupServerDetails: {
91+
host: 'https://blocktank.synonym.to/staging-backups-ldk',
92+
serverPubKey:
93+
'02c03b8b8c1b5500b622646867d99bf91676fac0f38e2182c91a9ff0d053a21d6d',
94+
},
8595
};
8696
};
8797

@@ -104,7 +114,7 @@ export default class TestProfile {
104114
return { name: this.name, seed: this.seed };
105115
};
106116

107-
public getAddress = async (): Promise<string> => {
117+
public getAddress = async (): Promise<IAddress> => {
108118
const network = getNetwork(this.network);
109119
const mnemonic = bip39.entropyToMnemonic(this.seed);
110120
const mnemonicSeed = await bip39.mnemonicToSeed(mnemonic);
@@ -117,7 +127,10 @@ export default class TestProfile {
117127
if (!address) {
118128
throw new Error('Failed to generate address');
119129
}
120-
return address;
130+
return {
131+
address: address,
132+
publicKey: keyPair.publicKey.toString('hex'),
133+
};
121134
};
122135

123136
public getScriptPubKeyHistory = async (

0 commit comments

Comments
 (0)