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

Full APIConsumer unit test mocking MockOracle request fulfillment #70

Merged
merged 4 commits into from
Jan 22, 2022

Conversation

rogargon
Copy link
Contributor

@rogargon rogargon commented Dec 3, 2021

The current version of the APIConsumer unit test just checks that the request is made. Added a new test that mocks oracle request fulfillment so the full process can be tested. This way, using a local network, it can be tested how the oracle response is processed.

Pattern ["ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git"] is trying to unpack in the same destination "/Users/roberto/Library/Caches/Yarn/v6/npm-ethereumjs-abi-0.6.8-integrity/node_modules/ethereumjs-abi" as pattern ["[email protected]","ethereumjs-abi@^0.6.8","[email protected]"]. This could result in non-deterministic behavior, skipping.
@PatrickAlphaC
Copy link
Contributor

This looks awesome! @andrejrakic, curious if this is something you can look at? Ideally we'd add the mocking VRF response too.

@andrejrakic andrejrakic self-requested a review December 7, 2021 09:29
@rogargon
Copy link
Contributor Author

rogargon commented Dec 8, 2021

As part of our Chainlink Hackathon submission, we also developed a task to simulate an oracle in the local test network. This helped during fronted development too. More details: https://github.com/rogargon/YTVideoNFTknz/blob/main/tasks/mockoracle.js

@andrejrakic
Copy link
Contributor

Hey @rogargon thanks for the PR, nice work! One thing, would you be kind to resolve a conflict on your local branch before the review process? Thanks in advance

@rogargon
Copy link
Contributor Author

rogargon commented Dec 9, 2021

Thanks! Conflict resolved

Copy link
Contributor

@andrejrakic andrejrakic left a comment

Choose a reason for hiding this comment

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

Nice work! Added some small suggestions, after that we can merge this PR.

test/unit/APIConsumer_unit_test.js Outdated Show resolved Hide resolved
test/unit/APIConsumer_unit_test.js Outdated Show resolved Hide resolved
test/unit/APIConsumer_unit_test.js Outdated Show resolved Hide resolved
@rogargon rogargon requested a review from andrejrakic January 21, 2022 16:55
Copy link
Contributor

@andrejrakic andrejrakic left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks again @rogargon for your contribution!

@andrejrakic andrejrakic merged commit ba31306 into smartcontractkit:main Jan 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants