Skip to content

Commit a8dba73

Browse files
committed
wip: update swift tests
1 parent 2643459 commit a8dba73

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

packages/swift/AlgoKitTransact/Tests/AlgoKitTransactTests/GenericTransactionTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func genericTransactionEncode0Bytes() throws {
2626
do {
2727
_ = try decodeTransaction(encodedTx: Data())
2828
#expect(Bool(false), "Expected DecodingError to be thrown")
29-
} catch AlgoKitTransactError.DecodingError(let message) {
29+
} catch AlgoKitTransactError.InputError(let message) {
3030
#expect(message == "attempted to decode 0 bytes")
3131
}
3232
}

packages/swift/AlgoKitTransact/Tests/AlgoKitTransactTests/TestUtils.swift

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,24 @@ import Foundation
33
@testable import AlgoKitTransact
44

55
struct TransactionTestData: Codable {
6-
struct AddressData: Codable {
7-
let address: String
8-
let pubKey: [UInt8]
9-
}
106

117
struct TransactionData: Codable {
12-
let sender: AddressData
8+
let sender: String
139
let fee: UInt64
1410
let transactionType: String
1511
let firstValid: UInt64
1612
let lastValid: UInt64
1713
let genesisHash: [UInt8]
1814
let genesisId: String
1915
let note: [UInt8]?
20-
let rekeyTo: AddressData?
16+
let rekeyTo: String?
2117
let lease: [UInt8]?
2218
let group: [UInt8]?
2319
let payment: PaymentFieldsData
2420
}
2521

2622
struct PaymentFieldsData: Codable {
27-
let receiver: AddressData
23+
let receiver: String
2824
let amount: UInt64
2925
}
3026

@@ -50,19 +46,19 @@ func loadTestData() throws -> TestData {
5046
func makeTransaction(from testData: TransactionTestData) -> Transaction {
5147
return Transaction(
5248
transactionType: .payment,
53-
sender: testData.transaction.sender.address,
49+
sender: testData.transaction.sender,
5450
fee: testData.transaction.fee,
5551
firstValid: testData.transaction.firstValid,
5652
lastValid: testData.transaction.lastValid,
5753
genesisHash: Data(testData.transaction.genesisHash),
5854
genesisId: testData.transaction.genesisId,
5955
note: testData.transaction.note != nil ? Data(testData.transaction.note!) : nil,
6056
rekeyTo: testData.transaction.rekeyTo != nil
61-
? testData.transaction.rekeyTo!.address : nil,
57+
? testData.transaction.rekeyTo! : nil,
6258
lease: testData.transaction.lease != nil ? Data(testData.transaction.lease!) : nil,
6359
group: testData.transaction.group != nil ? Data(testData.transaction.group!) : nil,
6460
payment: PaymentTransactionFields(
65-
receiver: testData.transaction.payment.receiver.address,
61+
receiver: testData.transaction.payment.receiver,
6662
amount: testData.transaction.payment.amount,
6763
closeRemainderTo: nil
6864
),

0 commit comments

Comments
 (0)