woocommerce-ios icon indicating copy to clipboard operation
woocommerce-ios copied to clipboard

[Reader Manuals Consolidation] Explore using configuration for testability on CardReaderManualsViewModel init

Open iamgabrielma opened this issue 2 years ago • 0 comments

From https://github.com/woocommerce/woocommerce-ios/pull/7266#discussion_r918012040

It might be worth passing in the configuration for testability here

When CardReaderManualsViewModel initializes, it already does by populating the model with the supported readers via the configuration loader:

init() {
        // Initialize the View Model only with the supported readers for a specific Store
        self.configurationLoader = CardPresentConfigurationLoader()
        let supportedReaders = configurationLoader.configuration.supportedReaders
        self.manuals = supportedReaders.map { $0.manual }
    }

It may be worth exploring it we should pass this configuration as an init parameter directly, in order to simplify tests.

iamgabrielma avatar Jul 12 '22 03:07 iamgabrielma