add more tests for CaliperEngine#1706
Conversation
davidkel
left a comment
There was a problem hiding this comment.
@tunedev Only a minor issue about how we setup the flow options and then just need to set the specific flow option to true that is being tested, plus cleanup of the whitespace. But all good apart from that, thanks for the PR (sorry it took so long to review)
| stubbedCaliperUtils.getFlowOptions.reset(); | ||
| stubbedCaliperUtils.execAsync.reset(); | ||
|
|
||
| stubbedCaliperUtils.getFlowOptions.returns({ |
There was a problem hiding this comment.
Not sure why this is here and probably can be removed
| let mockAdapter; | ||
|
|
||
| beforeEach(() => { | ||
| benchSandbox = sinon.createSandbox(); |
There was a problem hiding this comment.
I think it may be good here to set all the flows to false, then for each of the tests ensure that only the flows being tested get set.
| const testCMD = 'echo "Starting network"' | ||
|
|
||
| stubbedCaliperUtils.getFlowOptions.returns({ | ||
| performStart: true, |
There was a problem hiding this comment.
Let's just set the flow option that is going to be tested here to true, and not include the others
|
|
||
| it('should handle errors during start command execution', function() { | ||
| // TODO: Implement test | ||
| it('should handle errors during start command execution', async function() { |
There was a problem hiding this comment.
We should explicitly set the flow under test here
| }); | ||
|
|
||
| it('should handle a non-string start command', async function() { | ||
| const networkConfig = { caliper: { command: { start: 1234 } } } |
There was a problem hiding this comment.
We should explicitly set the flow under test here
| }); | ||
|
|
||
| const engine = new CaliperEngine({}, {}, () => {throw new Error('Failed to create adapter')}); | ||
|
|
| performInit: false, | ||
| performInstall: false, | ||
| performTest: false, | ||
| performEnd: true |
| stubbedConfigUtils.get.withArgs('caliper-workspace').returns('./'); | ||
| stubbedCaliperUtils.execAsync.resolves(); | ||
| const engine = new CaliperEngine({}, networkConfig, () => mockAdapter); | ||
|
|
| performInit: false, | ||
| performInstall: false, | ||
| performTest: false, | ||
| performEnd: true |
8637b09 to
bd1c2e7
Compare
Signed-off-by: Babatunde Sanusi <swisskid95@gmail.com>
bd1c2e7 to
ad0c2d5
Compare
Checklist
Issue/User story
Partially addresses #1557
Steps to Reproduce
Existing issues
Design of the fix
Validation of the fix
After this PR: Running the tests in caliper-core the listed %stmts in the code coverage report should tally with the below listed
Before the PR: Running the tests in caliper-core the listed %stmts in the code coverage report the below listed was what was there before
What documentation has been provided for this pull request