File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
BDKSwiftExampleWalletTests
BDKSwiftExampleWallet/View/Send Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ extension AddressView {
133133 }
134134 }
135135
136- private func extractWif( from value: String ) -> String ? {
136+ func extractWif( from value: String ) -> String ? {
137137 var candidates = [ value]
138138
139139 if let components = URLComponents ( string: value) ,
@@ -164,7 +164,7 @@ extension AddressView {
164164 return nil
165165 }
166166
167- private func isLikelyWif( _ value: String ) -> Bool {
167+ func isLikelyWif( _ value: String ) -> Bool {
168168 guard value. count == 51 || value. count == 52 else {
169169 return false
170170 }
Original file line number Diff line number Diff line change 55// Created by Matthew Ramsden on 5/22/23.
66//
77
8+ import SwiftUI
89import XCTest
910
1011@testable import BDKSwiftExampleWallet
1112
12- final class BDKSwiftExampleWalletTests : XCTestCase { }
13+ final class BDKSwiftExampleWalletTests : XCTestCase {
14+
15+ func testExtractWifDetectsPrefixedWifAndRejectsRandomString( ) {
16+ let view = AddressView ( navigationPath: . constant( NavigationPath ( ) ) )
17+ let likelyWif = " c " + String( repeating: " 1 " , count: 51 )
18+
19+ XCTAssertEqual ( view. extractWif ( from: " wif: \( likelyWif) " ) , likelyWif)
20+ XCTAssertNil (
21+ view. extractWif (
22+ from: " 12cUi8cuUJRiFmGEu4jCAsonSS1dkVyaD7Aoo6URRiXpmaokikuyM778786 "
23+ )
24+ )
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments