Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #7326: Add unit tests for update in asset detail store #7351

Merged
merged 3 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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