Skip to content

Instantly share code, notes, and snippets.

@frootloops
Created August 6, 2021 09:09
Show Gist options
  • Save frootloops/8f0f4afdf0a4a19a6d0dd1d96b6e5ccb to your computer and use it in GitHub Desktop.
Save frootloops/8f0f4afdf0a4a19a6d0dd1d96b6e5ccb to your computer and use it in GitHub Desktop.
// preparation
var priceAlertApiService = PriceAlertApiServiceMock()
var priceAlertStorageService = PriceAlertStorageServiceMock()
let repository = PriceAlertRepository(
network: priceAlertApiService,
storage: priceAlertStorageService
)
// actual test
priceAlertStorageService.cachedPriceAlertsMockFunc.returns(
[.sample(id: "1"), .sample(id: "2")]
)
let result = repository.cachedPriceAlerts(symbol: "AAPL")
expect(result.map { $0.id }) == ["1", "2"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment