Skip to content

ProductInfo / ProductInfoExtractorTests refactor#1039

Merged
NachoSoto merged 3 commits into
mainfrom
product-info-refactor
Dec 7, 2021
Merged

ProductInfo / ProductInfoExtractorTests refactor#1039
NachoSoto merged 3 commits into
mainfrom
product-info-refactor

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

NFC (not functional change)
Just a small refactor while working on #1038, separating here for easier review. Simplifying these will help when adding some new types to ProductInfo.

I'm guessing some of these things are leftovers from the Swift migration.

Changes:

  • Refactored ProductInfoExtractorTests, moved duplicated code into setUp
  • ProductInfoExtractor and ISOPeriodFormatter: replaced method with static function: these types contain no data, and there is only one possible implementation that we can have. For that reason, we're not mocking them or injecting them anywhere, so they're simpler as static functions. As an example, we had lazy var isoPeriodFormatter = ISOPeriodFormatter(), but again ISOPeriodFormatter contains no data, only logic, so there's no point having a lazy variable for it.

@NachoSoto NachoSoto force-pushed the product-info-refactor branch from c2c8015 to 08423ab Compare December 7, 2021 01:04

@taquitos taquitos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 🐐

@NachoSoto NachoSoto merged commit 6ab2aa1 into main Dec 7, 2021
@NachoSoto NachoSoto deleted the product-info-refactor branch December 7, 2021 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants