Skip to content

Commit 62a3ff2

Browse files
test: fix swift tests
1 parent a747c1a commit 62a3ff2

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

bdk-swift/Tests/BitcoinDevKitTests/OfflineWalletTests.swift

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,13 @@ final class OfflineWalletTests: XCTestCase {
1010
descriptor: "wpkh(tprv8ZgxMBicQKsPf2qfrEygW6fdYseJDDrVnDv26PH5BHdvSuG6ecCbHqLVof9yZcMoM31z9ur3tTYbSnr1WBqbGX97CbXcmp5H6qeMpyvx35B/84h/1h/0h/1/*)",
1111
network: Network.signet
1212
)
13-
var dbFilePath: URL!
14-
15-
override func setUpWithError() throws {
16-
super.setUp()
17-
let fileManager = FileManager.default
18-
let documentDirectory = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first!
19-
let uniqueDbFileName = "bdk_persistence_\(UUID().uuidString).sqlite"
20-
dbFilePath = documentDirectory.appendingPathComponent(uniqueDbFileName)
21-
22-
if fileManager.fileExists(atPath: dbFilePath.path) {
23-
try fileManager.removeItem(at: dbFilePath)
24-
}
25-
}
26-
27-
override func tearDownWithError() throws {
28-
let fileManager = FileManager.default
29-
if fileManager.fileExists(atPath: dbFilePath.path) {
30-
try fileManager.removeItem(at: dbFilePath)
31-
}
32-
}
33-
13+
3414
func testNewAddress() throws {
35-
let connection = try Connection(path: dbFilePath.path)
36-
let wallet = try Wallet.load(
15+
let connection = try Connection.newInMemory()
16+
let wallet = try Wallet(
3717
descriptor: descriptor,
3818
changeDescriptor: changeDescriptor,
19+
network: .signet,
3920
connection: connection
4021
)
4122
let addressInfo: AddressInfo = wallet.revealNextAddress(keychain: KeychainKind.external)
@@ -53,10 +34,11 @@ final class OfflineWalletTests: XCTestCase {
5334
}
5435

5536
func testBalance() throws {
56-
let connection = try Connection(path: dbFilePath.path)
57-
let wallet = try Wallet.load(
37+
let connection = try Connection.newInMemory()
38+
let wallet = try Wallet(
5839
descriptor: descriptor,
5940
changeDescriptor: changeDescriptor,
41+
network: .signet,
6042
connection: connection
6143
)
6244

0 commit comments

Comments
 (0)