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

Remove chains import for getBlock query #50

Merged
merged 1 commit into from
Nov 3, 2023
Merged

Conversation

0237h
Copy link
Collaborator

@0237h 0237h commented Nov 3, 2023

The import of the chains variable from fetch/openapi.ts caused a DB query to be executed once the module was loaded. This behavior was also preventing testing any function inside the queries.ts module.

The fix makes the getBlock function explicitly query the DB for supported chains (as they might also get updated over time). The function is mocked in the tests using the latest Bun feature (1.0.8+) of mock modules in order to allow "offline" testing.

The import of the `chains` variable from `fetch/openapi.ts` caused
a DB query to be executed once the module was loaded. This behavior
was also preventing testing any function inside the `queries.ts` module.

The fix makes the `getBlock` function explicitly query the DB for
supported chains (as they might also get updated over time). The
function is mocked in the tests using the latest Bun feature (1.0.8+)
of *mock modules* in order to allow "offline" testing.
@github-actions github-actions bot added the bug Something isn't working label Nov 3, 2023
Copy link
Contributor

@DenisCarriere DenisCarriere left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@0237h 0237h merged commit 66152da into main Nov 3, 2023
@0237h 0237h deleted the fix/test-mock-chains branch November 3, 2023 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants