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

Foundry tests for VRFCoordinatorV2Mock.sol #10606

Merged
merged 11 commits into from
Sep 12, 2023

Conversation

kidambisrinivas
Copy link
Collaborator

@kidambisrinivas kidambisrinivas commented Sep 12, 2023

Motivation

  • VRFCoordinatorV2Mock.sol only has hardhat tests.
  • We plan to move away from Hardhat tests in the long run.

Solution

  • Adding Foundry tests for all functionalities in VRFCoordinatorV2Mock.sol
  • Fixed compilation warnings in VRFCoordinatorV2Mock.sol

Testing

$ forge test -vvv --match-path test/v0.8/foundry/vrf/VRFCoordinatorV2Mock.t.sol
[⠃] Compiling...
[⠊] Compiling 1 files with 0.8.6
[⠆] Solc 0.8.6 finished in 3.11s
Compiler run successful!

Running 14 tests for test/v0.8/foundry/vrf/VRFCoordinatorV2Mock.t.sol:VRFCoordinatorV2MockTest
[PASS] testAddConsumer() (gas: 112759)
[PASS] testAddConsumerToInvalidSub() (gas: 16057)
[PASS] testAddMaxConsumers() (gas: 4504926)
[PASS] testCancelSubscription() (gas: 55840)
[PASS] testCreateSubscription() (gas: 91797)
[PASS] testFundInvalidSubscription() (gas: 16047)
[PASS] testFundSubscription() (gas: 70097)
[PASS] testRemoveConsumerAgain() (gas: 93787)
[PASS] testRemoveConsumerFromInvalidSub() (gas: 16024)
[PASS] testRemoveConsumerFromSub() (gas: 91801)
[PASS] testRequestRandomWordsHappyPath() (gas: 242054)
[PASS] testRequestRandomWordsInsufficientFunds() (gas: 160034)
[PASS] testRequestRandomWordsInvalidConsumer() (gas: 70508)
[PASS] testRequestRandomWordsUserOverride() (gas: 229174)
Test result: ok. 14 passed; 0 failed; 0 skipped; finished in 5.51ms

Ran 1 test suites: 14 tests passed, 0 failed, 0 skipped (14 total tests)

@kidambisrinivas kidambisrinivas changed the title Vrf 602 mock coordinator v2 test Foundry tests for VRFCoordinatorV2Mock.sol Sep 12, 2023
@github-actions
Copy link
Contributor

I see that you haven't updated any README files. Would it make sense to do so?

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

@cl-sonarqube-production
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@kidambisrinivas kidambisrinivas added this pull request to the merge queue Sep 12, 2023
Merged via the queue into develop with commit 43080c2 Sep 12, 2023
123 checks passed
@kidambisrinivas kidambisrinivas deleted the VRF-602-mock-coordinator-v2-test branch September 12, 2023 20:19
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.

2 participants