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

add unit tests for handlePoolCreated #227

Merged
merged 5 commits into from
May 29, 2024
Merged

Conversation

mzywang
Copy link
Collaborator

@mzywang mzywang commented May 20, 2024

Adds unit test for the poolCreated handler and updates the github action for running the unit tests (see image for example of failing test)
image

Note that some changes were made to the subgraph code to support testing

  • Because of limitations on the subgraph code, we had to introduce a helper handler to unit test instead of the actual handler itself (the actual handler must have a specific signature, but we want to inject some fields for the sake of testing)
  • Functions cannot be injected in subgraph code, but static data can be, so I updated the StaticTokenDefinition structure to be a static constant rather than a class method.

Copy link
Collaborator Author

mzywang commented May 20, 2024

Copy link

socket-security bot commented May 20, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/matchstick-as@0.6.0 filesystem +1 7.95 MB maksdim

View full report↗︎

@mzywang mzywang force-pushed the 05-20-add_subgraph_unit_tests branch 6 times, most recently from a18518d to 3ca291f Compare May 20, 2024 17:17
src/utils/token.ts Outdated Show resolved Hide resolved
tests/.latest.json Outdated Show resolved Hide resolved
@mzywang mzywang force-pushed the 05-20-add_subgraph_unit_tests branch 5 times, most recently from 4fe3a56 to 2b520a9 Compare May 20, 2024 20:00
@mzywang mzywang force-pushed the 05-20-add_subgraph_unit_tests branch from 2b520a9 to 4cfbce3 Compare May 21, 2024 20:58
@mzywang mzywang changed the base branch from main to 05-09-update_mainnet_minimum_eth_locked May 21, 2024 20:58
@mzywang mzywang changed the title add subgraph unit tests add unit tests for handlePoolCreated May 21, 2024
@mzywang mzywang force-pushed the 05-20-add_subgraph_unit_tests branch from 5e4c922 to 87cfa3d Compare May 21, 2024 21:25
@mzywang mzywang marked this pull request as ready for review May 21, 2024 21:30
@mzywang mzywang changed the base branch from 05-09-update_mainnet_minimum_eth_locked to main May 21, 2024 21:30
@mzywang mzywang closed this May 21, 2024
@mzywang mzywang reopened this May 21, 2024
@mzywang mzywang changed the base branch from main to 05-09-update_mainnet_minimum_eth_locked May 21, 2024 21:33
@mzywang mzywang changed the base branch from 05-09-update_mainnet_minimum_eth_locked to main May 21, 2024 21:33
@mzywang mzywang force-pushed the 05-20-add_subgraph_unit_tests branch 9 times, most recently from ca097d3 to dbe0058 Compare May 22, 2024 14:07
@mzywang mzywang changed the base branch from main to 05-09-update_mainnet_minimum_eth_locked May 22, 2024 15:14
@mzywang mzywang requested a review from ianlapham May 22, 2024 15:17
@mzywang mzywang force-pushed the 05-20-add_subgraph_unit_tests branch from ccd3103 to 4b42578 Compare May 22, 2024 15:17
@mzywang mzywang mentioned this pull request May 25, 2024
@mzywang mzywang requested a review from DefiPanda May 28, 2024 16:43
@mzywang mzywang force-pushed the 05-20-add_subgraph_unit_tests branch from 4b42578 to 1dfb743 Compare May 29, 2024 15:46
@mzywang mzywang changed the base branch from 05-09-update_mainnet_minimum_eth_locked to main May 29, 2024 15:46
@mzywang mzywang closed this May 29, 2024
@mzywang mzywang reopened this May 29, 2024
@mzywang mzywang merged commit 9ad0bcc into main May 29, 2024
2 checks passed
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