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

Refactor Mock Implementation in Tests #164

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

magecnion
Copy link
Contributor

@magecnion magecnion commented Nov 9, 2023

PR Type:

Refactoring


PR Description:

This PR refactors the mock implementation in the tests of the ownership-chain/precompile/laos-evolution/src/tests.rs file. The main changes include:

  • Introduced a new struct PrecompileMockParams in the helpers module to hold the results of different mock methods.
  • Refactored the impl_precompile_mock_simple! macro to use the PrecompileMockParams struct instead of individual variables for each method result.
  • Updated all the test cases to use the new PrecompileMockParams struct.

PR Main Files Walkthrough:

files:
  • ownership-chain/precompile/laos-evolution/src/tests.rs: The file contains tests for the ownership-chain/precompile/laos-evolution module. The changes in this file are mainly about refactoring the mock implementation used in the tests. A new struct PrecompileMockParams is introduced in the helpers module to hold the results of different mock methods. The impl_precompile_mock_simple! macro is refactored to use this new struct. All the test cases are updated to use the new PrecompileMockParams struct.

@magecnion
Copy link
Contributor Author

/describe

@github-actions github-actions bot changed the title Refactor use struct as param in mocks Refactor Mock Implementation in Tests Nov 9, 2023
@magecnion magecnion linked an issue Nov 9, 2023 that may be closed by this pull request
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

if you don't mind, I would propose to move these macro to /precompile/utils/test.rs. And use only that definition in both precompiles: evolution and ownership. because they are repeatedly declared now

@magecnion magecnion requested a review from a user November 9, 2023 16:12
@magecnion magecnion merged commit adcfce9 into main Nov 10, 2023
7 checks passed
@magecnion magecnion deleted the refactor/use_struct_as_param_in_mocks branch November 10, 2023 08:54
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.

Evochain Collections by contractAddress instead of collectionId
1 participant