Skip to content

Commit cb2333b

Browse files
committed
bdd tests
1 parent 54c80da commit cb2333b

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

test/bdd/steps/common.mjs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,7 @@ Given(
6464
if (response.error) {
6565
assert.fail(`Error while initializing node${nodeIndex}: ${response.error}`);
6666
} else {
67-
// todo if started
68-
const client = new DkgClientHelper({
69-
endpoint: 'http://localhost',
70-
port: rpcPort,
71-
maxNumberOfRetries: 5,
72-
frequency: 2,
73-
contentType: 'all',
74-
});
67+
// Build blockchain options BEFORE creating the client
7568
let clientBlockchainOptions = {};
7669
Object.keys(this.state.localBlockchains).forEach((blockchainId, index) => {
7770
const blockchain = this.state.localBlockchains[blockchainId];
@@ -87,6 +80,25 @@ Given(
8780
};
8881
});
8982

83+
// Get the first blockchain for the DKG client config
84+
const firstBlockchainId = Object.keys(this.state.localBlockchains)[0];
85+
const firstBlockchain = this.state.localBlockchains[firstBlockchainId];
86+
const firstWallet = firstBlockchain.getWallets()[0];
87+
88+
const client = new DkgClientHelper({
89+
endpoint: 'http://localhost',
90+
port: rpcPort,
91+
maxNumberOfRetries: 5,
92+
frequency: 2,
93+
contentType: 'all',
94+
blockchain: {
95+
name: firstBlockchainId,
96+
publicKey: firstWallet.address,
97+
privateKey: firstWallet.privateKey,
98+
rpc: `http://localhost:${firstBlockchain.port}`,
99+
},
100+
});
101+
90102
this.state.nodes[nodeIndex] = {
91103
client,
92104
forkedNode,

0 commit comments

Comments
 (0)