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 service classes to reuse common service setup code #4994

Open
Gudahtt opened this issue Nov 27, 2024 · 1 comment
Open

Refactor service classes to reuse common service setup code #4994

Gudahtt opened this issue Nov 27, 2024 · 1 comment
Assignees
Labels

Comments

@Gudahtt
Copy link
Member

Gudahtt commented Nov 27, 2024

Each of our services that follow the pattern outlined in https://github.com/MetaMask/decisions/blob/main/decisions/core/0002-external-api-integrations.md have a chunk of boilerplate that is identical for each service. We can make services easier to write by refactoring our existing services to use a common function for these boilerplate setup steps.

This would also dramatically simplify the effort needed to test new services. The base service policy we have is complex to test, and we're re-testing various conditions over and over with each new service. If we implemented the basic service pattern in a shared function, we could test it exhaustively just in that function, and focus on service-specific logic in our tests for each service.

@Gudahtt Gudahtt added enhancement New feature or request team-wallet-framework labels Nov 27, 2024
@mcmire
Copy link
Contributor

mcmire commented Dec 6, 2024

If in implementing the RPC service class in #4990 we need to create a separate policy object for each RPC endpoint, then it seems that to satisfy this ticket it would make the most sense to create a function that would construct and return the policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants