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.
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.