Skip to content

Commit

Permalink
Fix brave/brave-ios#7326: Add unit tests for update in asset detail s…
Browse files Browse the repository at this point in the history
  • Loading branch information
nuo-xu authored Apr 27, 2023
1 parent 5502021 commit d2904ba
Show file tree
Hide file tree
Showing 3 changed files with 542 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/BraveWallet/Crypto/Stores/AssetDetailStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class AssetDetailStore: ObservableObject {
buyOptions = [.ramp, .transak]
}
self.allBuyTokensAllOptions = await blockchainRegistry.allBuyTokens(in: network, for: buyOptions)
let buyTokens = allBuyTokensAllOptions.flatMap{ $0.value }
let buyTokens = allBuyTokensAllOptions.flatMap { $0.value }
return buyTokens.first(where: { $0.symbol.caseInsensitiveCompare(symbol) == .orderedSame }) != nil
}

Expand Down
31 changes: 31 additions & 0 deletions Sources/BraveWallet/Preview Content/MockContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,35 @@ extension TransactionSummary {
)
}
}

extension BraveWallet.CoinMarket {
static var mockCoinMarketBitcoin: BraveWallet.CoinMarket {
.init(
id: "bitcoin",
symbol: "btc",
name: "Bitcoin",
image: "https://assets.cgproxy.brave.com/coins/images/1/large/bitcoin.png?1547033579",
marketCap: 547558353670,
marketCapRank: 1,
currentPrice: 28324,
priceChange24h: 163.96,
priceChangePercentage24h: 0.58225,
totalVolume: 30825602847
)
}
static var mockCoinMarketEth: BraveWallet.CoinMarket {
.init(
id: "ethereum",
symbol: "eth",
name: "Ethereum",
image: "https://assets.cgproxy.brave.com/coins/images/279/large/ethereum.png?1595348880",
marketCap: 223719056533,
marketCapRank: 2,
currentPrice: 1860.57,
priceChange24h: -4.2550480604149925,
priceChangePercentage24h: -0.22817,
totalVolume: 15998007227
)
}
}
#endif
Loading

0 comments on commit d2904ba

Please sign in to comment.