Skip to content

Commit a5edce3

Browse files
author
nathanieliov
committed
Apply consistent formatting changes across test files to improve readability and enforce existing code style standards.
1 parent 21252f5 commit a5edce3

File tree

74 files changed

+8404
-5392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+8404
-5392
lines changed

cleanEnv.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,50 @@ require('dotenv').config();
77
const killServicesCommand = "kill $(ps -A | grep -e java -e bitcoind | awk '{print $1}')";
88

99
async function clearLogFiles(directory) {
10-
try {
11-
const files = await fs.promises.readdir(directory, { withFileTypes: true });
12-
13-
for (const file of files) {
14-
const filePath = path.join(directory, file.name);
15-
16-
if (file.isDirectory()) {
17-
await clearLogFiles(filePath);
18-
} else if (path.extname(file.name) === ".log") {
19-
await fs.promises.truncate(filePath, 0);
20-
console.log(`Cleared content of file: ${filePath}`);
21-
}
10+
try {
11+
const files = await fs.promises.readdir(directory, { withFileTypes: true });
12+
13+
for (const file of files) {
14+
const filePath = path.join(directory, file.name);
15+
16+
if (file.isDirectory()) {
17+
await clearLogFiles(filePath);
18+
} else if (path.extname(file.name) === '.log') {
19+
await fs.promises.truncate(filePath, 0);
20+
console.log(`Cleared content of file: ${filePath}`);
21+
}
22+
}
23+
} catch (err) {
24+
console.error(`Error processing directory ${directory}: ${err.message}`);
2225
}
23-
} catch (err) {
24-
console.error(`Error processing directory ${directory}: ${err.message}`);
25-
}
2626
}
2727

2828
function clearBitcoinDataDirectory() {
29-
return new Promise((resolve, reject) => {
30-
const directory = process.env.BITCOIN_DATA_DIR;
31-
32-
if (!directory) {
33-
return reject(new Error("BITCOIN_DATA_DIR is not set."));
34-
}
35-
36-
fs.readdir(directory, (err, files) => {
37-
if (err) {
38-
return reject(new Error(`Error reading directory ${directory}: ${err.message}`));
39-
}
40-
41-
const deletePromises = files.map(file => {
42-
const filePath = path.join(directory, file);
43-
return fs.promises.rm(filePath, { recursive: true, force: true });
44-
});
45-
46-
Promise.all(deletePromises)
47-
.then(() => {
48-
console.log(`Successfully cleared contents of: ${directory}`);
49-
resolve();
50-
})
51-
.catch(reject);
29+
return new Promise((resolve, reject) => {
30+
const directory = process.env.BITCOIN_DATA_DIR;
31+
32+
if (!directory) {
33+
return reject(new Error('BITCOIN_DATA_DIR is not set.'));
34+
}
35+
36+
fs.readdir(directory, (err, files) => {
37+
if (err) {
38+
return reject(new Error(`Error reading directory ${directory}: ${err.message}`));
39+
}
40+
41+
const deletePromises = files.map((file) => {
42+
const filePath = path.join(directory, file);
43+
return fs.promises.rm(filePath, { recursive: true, force: true });
44+
});
45+
46+
Promise.all(deletePromises)
47+
.then(() => {
48+
console.log(`Successfully cleared contents of: ${directory}`);
49+
resolve();
50+
})
51+
.catch(reject);
52+
});
5253
});
53-
});
5454
}
5555
const cleanEnvironment = async () => {
5656
console.info('Cleaning environment...');

config/regtest-all-keyfiles.js

Lines changed: 271 additions & 114 deletions
Large diffs are not rendered by default.

config/regtest-key-files-and-hsms.js

Lines changed: 185 additions & 99 deletions
Large diffs are not rendered by default.

lib/2wp-utils-legacy.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@ const rsk = require('peglib').rsk;
33
const rskUtilsLegacy = require('./rsk-utils-legacy');
44

55
const sendTxToBridgeWithoutMining = (rskClient) => async (senderAddress, valueInWeis) => {
6-
76
return new Promise((resolve, reject) => {
87
const sendResult = rskClient.eth.sendTransaction({
98
from: senderAddress,
109
to: rsk.getBridgeAddress(),
1110
value: valueInWeis,
12-
gasPrice: 2
11+
gasPrice: 2,
1312
});
1413

1514
sendResult.catch((err) => reject(err));
1615
sendResult.once('transactionHash', (txHash) => {
1716
resolve(txHash);
1817
});
19-
})
20-
}
18+
});
19+
};
2120

2221
const createPegoutRequest = async (rskClient, pegClient, amountInRBTC, requestSize = 1) => {
2322
const AMOUNT_IN_WEIS = rsk.btcToWeis(amountInRBTC);
@@ -34,11 +33,10 @@ const createPegoutRequest = async (rskClient, pegClient, amountInRBTC, requestSi
3433
for (let i = 0; i < requestSize; i++) {
3534
await sendTxToBridgeFunction(addresses.rsk, AMOUNT_IN_WEIS);
3635
}
37-
await rskClient.evm.mine()
38-
}
36+
await rskClient.evm.mine();
37+
};
3938

4039
module.exports = {
41-
with: (btcClient, rskClient) => ({
42-
}),
40+
with: (btcClient, rskClient) => ({}),
4341
createPegoutRequest,
4442
};

0 commit comments

Comments
 (0)