Skip to content

Update WealthsimpleDownloader to Swift Testing and refactor to inject dependencies - #204

Merged
Nef10 merged 6 commits into
mainfrom
test2
Aug 16, 2026
Merged

Update WealthsimpleDownloader to Swift Testing and refactor to inject dependencies#204
Nef10 merged 6 commits into
mainfrom
test2

Conversation

@Nef10

@Nef10 Nef10 commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • inject HTTP client and endpoint configuration dependencies into the Wealthsimple downloader
  • replace global URL-protocol mocks with per-test mock HTTP clients
  • make URL configuration immutable and remove test serialization

Validation

  • swift test --filter WealthsimpleDownloaderTests passed with 126 tests in 10 suites.

Impact

Tests are isolated from global networking and endpoint state, allowing downloader suites to run concurrently.

@Nef10
Nef10 marked this pull request as ready for review August 16, 2026 06:36
@Nef10 Nef10 changed the title Inject Wealthsimple downloader dependencies Update WealthsimpleDownloader to Swift Testing and refactor to inject dependencies Aug 16, 2026
@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown

Minimum coverage required: 83%

Coverage after merging test2 into main will be

83.71%

Coverage Report
FileStmtsFuncsLinesUncovered Lines
Sources/CompassCardDownloader
   CompassCardDownloader.swift2.50%6.67%2.07%100–119, 12–16, 37–57, 68–88, 90–99
Sources/GoogleAuthentication
   ASWebAuthenticationURLHandler.swift0%0%0%21–24, 26–42
   Authentication.swift17.65%14.29%17.95%100, 102–109, 111–128, 64–79, 90–99
Sources/RogersBankDownloader
   DownloadError.swift85.71%100%85%37, 39, 41
   RogersAccount.swift0%0%0%102–106, 108–112, 138–140, 142–168, 170–172, 174–176, 178–180, 182–206, 208–238, 240–242, 244–275, 277–284
   RogersActivity.swift96.77%100%95.83%242
   RogersAuthenticator.swift0%0%0%100–104, 106–115, 117–121, 123, 129–131, 133–157, 159–161, 163–170, 172–177, 185–201, 203–235, 237–268, 270–301, 303–335, 86–95, 97–99
   RogersUser.swift0%0%0%28–30
   URLTaskHelper.swift0%0%0%10–18, 7–9
Sources/SwiftBeanCountCLI
   ColorizedCommand.swift100%100%100%
   FormattableCommand.swift100%100%100%
   FormattableLedgerCommand.swift100%100%100%
   LedgerCommand.swift100%100%100%
   SwiftBeanCountCLI.swift100%100%100%
Sources/SwiftBeanCountCLI/SubCommands
   Accounts.swift100%100%100%
   Check.swift100%100%100%
   Stats.swift100%100%100%
   TaxSlips.swift100%100%100%
   TaxableSales.swift96.63%85.71%98.09%
Sources/SwiftBeanCountCompassCardMapper
   SwiftBeanCountCompassCardMapper.swift97.89%94.12%98.72%
   SwiftBeanCountCompassCardMapperError.swift100%100%100%
Sources/SwiftBeanCountImporter
   BaseImporter.swift97.96%96.67%98.29%46
   CSVBaseImporter.swift91.04%80%92.98%74–76
   CSVImporter.swift97.62%100%97.37%52
   DownloadImporter.swift100%100%100%
   FileImporter.swift100%100%100%
   Importer.swift98.33%100%98.04%274
   Settings.swift100%100%100%
   TextImporter.swift100%100%100%
Sources/SwiftBeanCountImporter/Importers
   CompassCardDownloadImporter.swift95.62%92.86%95.98%109–110, 126–127, 153–155, 207
   CompassCardImporter.swift100%100%100%
   EquatePlusImporter.swift98.38%100%98.14%178–181, 218, 285
   GoogleSheetDownloadImporter.swift17.65%30.77%15.90%110–131, 133–158, 160–165, 167–169, 17, 170–174, 18–19, 26–77, 79
   LunchOnUsImporter.swift100%100%100%
   ManuLifeImporter.swift96.63%96.49%96.66%270, 276, 318, 364–371
   N26Importer.swift100%100%100%
   RBCImporter.swift100%100%100%
   RogersDownloadImporter.swift99.13%98.18%99.26%193, 246
   RogersImporter.swift100%100%100%
   SimpliiImporter.swift100%100%100%
   TangerineAccountImporter.swift100%100%100%
   TangerineCardImporter.swift100%100%100%
   TangerineDownloadImporter.swift99.45%100%99.36%162, 209
   WealthsimpleDownloadImporter.swift97.18%94.74%97.47%263–271
Sources/SwiftBeanCountModel
   Account.swift98.40%96.88%98.71%214
   AccountName.swift92.13%93.33%91.89%100–104, 99
   Amount.swift100%100%100%
   Balance.swift100%100%100%
   Commodity.swift100%100%100%
   Cost.swift100%100%100%
   Custom.swift100%100%100%
   Event.swift100%100%100%
   Flag.swift100%100%100%
   Inventory.swift97.77%96.77%97.97%76–77
   Ledger.swift100%100%100%
   MultiCurrencyAmount.swift100%100%100%
   Option.swift100%100%100%
   Price.swift89.55%91.67%89.09%100, 95–99
   Tag.swift77.78%80%76.92%59–61
   Transaction.swift99.29%100%99.15%143
   TransactionMetaData.swift100%100%100%
   TransactionPosting.swift95.79%94.12%95.95%161–162, 178, 197, 283, 285
Sources/SwiftBeanCountParser
   AccountParser.swift97.83%100%97.62%43
   BalanceParser.swift100%100%100%
   CommodityParser.swift100%100%100%
   CostParser.swift100%100%100%
   CustomsParser.swift100%100%100%
   DateParser.swift100%100%100%
   EventParser.swift100%100%100%
   MetaDataParser.swift100%100%100%
   OptionParser.swift100%100%100%
   Parser.swift98.79%97.14%98.99%104, 207
   PluginParser.swift100%100%100%
   PostingParser.swift100%100%100%
   PriceParser.swift100%100%100%
   TransactionMetaDataParser.swift100%100%100%
Sources/SwiftBeanCountParser/Extensions
   Collection.swift100%100%100%
Sources/SwiftBeanCountParserUtils
   String.swift100%100%100%
Sources/SwiftBeanCountRogersBankMapper
   RogersBankMappingError.swift100%100%100%
   SwiftBeanCountRogersBankMapper.swift99.32%100%99.21%74
Sources/SwiftBeanCountSheetSync
   Downloader.swift0%0%0%18–43, 45–59, 61–73
   LedgerReader.swift85.86%80%86.90%15–22, 54
   LedgerSettings.swift100%100%100%
   SheetCellsFormatter.swift92.59%89.29%92.94%231, 264, 274, 282–286, 319–321, 331–333, 371, 82
   SheetDownloader.swift0%0%0%21–28, 31–35, 37–53
   SheetParser.swift97.78%100%97.55%223, 232, 235, 328, 331, 415, 448, 99
   Syncer.swift60.38%66.67%59.25%131–134, 155–172, 183–195, 220, 234–244, 284, 304, 368–385, 39, 41
   TransactionMapper.swift100%100%100%
   Uploader.swift0%0%0%18–30, 36–65, 71–75
Sources/SwiftBeanCountStatements
   AccountStartEndDateValidator.swift100%100%100%
   LatestStatementValidator.swift96.49%83.33%98.04%
   StatementDatesValidator.swift81.11%100%79.76%151, 155–156, 161, 163–164, 166–173, 175–176, 197–198, 203, 205–206, 208–215, 217–218, 233, 237–238
   StatementFileValidator.swift89.02%81.82%90.14%41, 51–52, 82–83
   StatementValidator.swift93.75%87.50%95.83%14
   StatementValidatorError.swift100%100%100%
Sources/SwiftBeanCountTangerineMapper
   SwiftBeanCountTangerineMapper.swift98.04%94.74%98.80%
   SwiftBeanCountTangerineMapperError.swift100%100%100%
Sources/SwiftBeanCountTax
   Sale.swift100%100%100%
   TaxCalculator.swift99.21%98.99%99.26%191, 82
   TaxErrors.swift100%100%100%
   TaxSlip.swift98.76%98.25%98.92%27, 65
Sources/SwiftBeanCountWealthsimpleMapper
   LedgerLookup.swift98.62%96.15%99.16%
   WealthsimpleConversionError.swift100%100%100%
   WealthsimpleLedgerMapper+Helpers.swift95.56%95.65%95.54%128, 173, 182, 55, 68, 81, 93
   WealthsimpleLedgerMapper+TransactionMapping.swift98.94%100%98.84%156–157
   WealthsimpleLedgerMapper.swift99.21%100%99.12%236, 241
   WealthsimpleTransactionID.swift100%100%100%
Sources/SwiftBeanCountWealthsimpleMapper/Extensions
   Amount+init.swift100%100%100%
   String+KebabCase.swift100%100%100%
   WealthsimpleDownloader.Transaction+Helper.swift100%100%100%
Sources/TangerineDownloader
   TangerineDownloader.swift1.45%3.85%1.20%100–129, 13, 130–139, 14, 140–143, 145–149, 15, 150–159, 16, 160–169, 17, 170–172, 38–59, 70–91, 93–99
   TangerineDownloaderError.swift100%100%100%
Sources/WealthsimpleDownloader
   DownloaderDependencies.swift0%0%0%17–19, 25–27, 33–41
   Token.swift97.27%94.74%97.51%133–134, 154–155
   Transaction.swift88.06%42.86%93.33%
   URLConfiguration.swift100%100%100%
   WealthsimpleAPI.swift96.27%92.86%96.67%49–51, 66
   WealthsimpleAccount.swift88.37%60%92.11%112–113
   WealthsimpleAsset.swift86.67%50%92.31%
   

@Nef10
Nef10 merged commit 05e8a2a into main Aug 16, 2026
3 checks passed
@Nef10
Nef10 deleted the test2 branch August 16, 2026 17:45
@Nef10 Nef10 added the tests Improvements to automated tests label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Improvements to automated tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant