Add fake price fetcher for debug mode
This commit is contained in:
18
SatsPrice/Network/FakePriceFetcher.swift
Normal file
18
SatsPrice/Network/FakePriceFetcher.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// FakePriceFetcher.swift
|
||||
// SatsPrice
|
||||
//
|
||||
// Created by Terry Yiu on 2/21/24.
|
||||
//
|
||||
|
||||
#if DEBUG
|
||||
import Foundation
|
||||
import BigDecimal
|
||||
|
||||
/// Fake price fetcher that returns a randomized price. Useful for development testing without requiring a network call.
|
||||
class FakePriceFetcher: PriceFetcher {
|
||||
func btcToUsd() async throws -> BigDecimal? {
|
||||
BigDecimal(Double.random(in: 10000...100000))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user