hyperledger-cacti/cacti

test(besu): refactor jest test negative test cases

Closed this issue · 4 comments

Description

Refactor all the negative test case exception assertions for cactus-plugin-ledger-connector-besu so that they do not use try-catch blocks but instead declare the requirements through Jest's (and jest-extended's) own API.

The parent issue with a much more detailed explanation of what's needed and code examples on how to do it:
Parent Issue: https://github.com/hyperledger/cacti/issues/3455

Acceptance Criteria
Test passes the same as before
Negative test case assertions have been migrated the way it is explained in the parent issue.

Please assign me.

@jagpreetsinghsasan

  1. In the PR I have noted two tests in openapi-validation.test.ts where the status code returned should be 400 but is 200 - before refactoring those I wanted to confirm if this is correct. I print those status codes with comments on these lines:

https://github.com/hyperledger/cacti/blob/f70e0f5834160e22304edc39a1cfeee3945cd8b0/packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/openapi/openapi-validation.test.ts#L882

https://github.com/hyperledger/cacti/blob/f70e0f5834160e22304edc39a1cfeee3945cd8b0/packages/cactus-plugin-ledger-connector-besu/src/test/typescript/integration/plugin-ledger-connector-besu/openapi/openapi-validation.test.ts#L981

  1. I left the original try-catch blocks as comments in the PR for your reference in case it is helpful while reviewing - I can take them out once you are done reviewing and/or if you don't need them.

@ashnashahgrover

  1. Please mention this point in the PR rather than here while referencing the lines within the PR commit. That way, it will be easier to navigate
  2. You dont have to add the previous code as in code comment. This is already enabled when we review the PR (you can also check the Files Changed tab under the PR), we can see the difference.
    For example
    image

You can also utilize the git graph plugin to view commits and their diff