Open davidkel opened 2 months ago
Hey @davidkel . I'd like to work on this issue if this is available !
@Sweetdevil144 I've assigned it to you
Thanks @davidkel . Also, can you help me with a heads up for this step? What should be my network configurations when mocking connectorFactory.js
?
@Sweetdevil144 all I can suggest is review how the caliper-fabric does it's tests. I'm not actually familiar with the ethereum package sorry. The caliper-fabric tests are the pattern to follow.
Created tests for connector-Factory.js
. I'm trying to create tests for ethereum-connector.js
but it keeps throwing logs as below when I logged the info as follow :
let configPath = CaliperUtils.resolvePath(ConfigUtil.get(ConfigUtil.keys.NetworkConfig));
console.log(`Config Path: ${JSON.stringify(configPath)}`);
let ethereumConfig;
try {
ethereumConfig = require(configPath).ethereum;
} catch (error) {
console.error(`Error requiring configPath: ${error}`);
throw error;
}
Original code lines were as follow : https://github.com/hyperledger/caliper/blob/ae23774d7bba51b55980cdc9110b11729aab96f7/packages/caliper-ethereum/lib/ethereum-connector.js#L46
Error logs :
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined
at Module.require (node:internal/modules/cjs/loader:1223:3)
at require (node:internal/modules/helpers:179:18)
at new EthereumConnector (lib/ethereum-connector.js:50:30)
at Context.<anonymous> (test/ethereum-connector.js:100:27)
at process.processImmediate (node:internal/timers:478:21)
Take a look at my current test file from : here to know how I'm mocking the data. (I found some test network configs for ethereum pre-created, utilising the same for now).
This package has no unit tests at all New tests should not assume that the code is actually correct. It's expected that if the tests finds bugs or relevant situations where unexpected behaviour occurs then the code should also be fixed.