Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jellyfish-testing): TestingWrapper as an abstraction layer #1093

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

surangap
Copy link
Contributor

What this PR does / why we need it:

Tries a different approach to address #637 and #965 instead of #1035

Here we introduce TestingWrapper class to create a new layer of abstraction with the goal of being able to create a test /testGroup instance in a standardized manner.
creating a new layer seems to introduce the least amount of changes to existing use cases

Also adds the capability to add NonMasternode RegTestContainers to the tests. For this, NonMNTesting class has been introduced.

Again this is not the most perfect way to do this. But given the restrictions discussed here -> #1035 (comment), this way seems not ugly and at the same time serves the purpose.

Which issue(s) does this PR fixes?:

Fixes #637
Fixes #965

Additional comments?:

@codeclimate
Copy link

codeclimate bot commented Feb 23, 2022

Code Climate has analyzed commit 26981fb and detected 8 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 8

View more on Code Climate.

@netlify
Copy link

netlify bot commented Feb 23, 2022

✔️ Deploy Preview for jellyfish-defi ready!

🔨 Explore the source changes: 26981fb

🔍 Inspect the deploy log: https://app.netlify.com/sites/jellyfish-defi/deploys/62170bb70d071400081bd332

😎 Browse the preview: https://deploy-preview-1093--jellyfish-defi.netlify.app

@codecov
Copy link

codecov bot commented Feb 23, 2022

Codecov Report

Merging #1093 (26981fb) into main (ddc6b7f) will decrease coverage by 0.00%.
The diff coverage is 76.31%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1093      +/-   ##
==========================================
- Coverage   95.69%   95.69%   -0.01%     
==========================================
  Files         169      170       +1     
  Lines        5045     5113      +68     
  Branches      657      665       +8     
==========================================
+ Hits         4828     4893      +65     
- Misses        208      211       +3     
  Partials        9        9              
Impacted Files Coverage Δ
packages/jellyfish-testing/src/testing.ts 85.00% <65.38%> (-15.00%) ⬇️
packages/jellyfish-testing/src/testingwrapper.ts 100.00% <100.00%> (ø)
packages/jellyfish-address/src/p2wpkh.ts 67.64% <0.00%> (-32.36%) ⬇️
...ackages/jellyfish-api-core/src/category/account.ts 100.00% <0.00%> (+4.47%) ⬆️
...ckages/jellyfish-api-core/src/category/poolpair.ts 100.00% <0.00%> (+7.40%) ⬆️
...h-transaction-builder/src/txn/txn_builder_loans.ts 100.00% <0.00%> (+12.12%) ⬆️
packages/jellyfish-address/src/p2pkh.ts 100.00% <0.00%> (+33.33%) ⬆️
apps/legacy-api/src/controllers/MiscController.ts 100.00% <0.00%> (+44.44%) ⬆️
apps/ocean-api/src/controllers/RawTxController.ts 100.00% <0.00%> (+44.44%) ⬆️
packages/ocean-api-client/src/apis/RawTx.ts 100.00% <0.00%> (+50.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ddc6b7f...26981fb. Read the comment docs.

@surangap surangap marked this pull request as ready for review February 24, 2022 04:42
@surangap surangap added the kind/feature New feature request label Feb 24, 2022
return TestingGroup.create(n, init)
}

createNonMN (): NonMNTesting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to start a quick discussion on naming since it will be harder to change later once this starts spreading into our testing structures.

From initial reading NonMN twists the tongue a little. Wondering if perhaps we want to create a proper name for a reg container that is not a MasterNode. I was thinking perhaps PartialNode?

And then since we are creating individual methods with expected outcomes perhaps the wrapper exposes.

createMasterNode and createPartialNode

It creates a little more uniformity in naming and I think more clear in their meaning, thoughts?

@fuxingloh fuxingloh changed the title feat(jellyfish-testing):Add TestingWrapper as an abstraction layer feat(jellyfish-testing): TestingWrapper as an abstraction layer Jan 19, 2023
@fuxingloh fuxingloh marked this pull request as draft January 19, 2023 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants