-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathTokenAllowanceTests.swift
36 lines (25 loc) · 1.02 KB
/
TokenAllowanceTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-License-Identifier: Apache-2.0
import SnapshotTesting
import XCTest
@testable import Hiero
internal final class TokenAllowanceTests: XCTestCase {
private static let testSpenderAccountId = AccountId("0.2.24")
private static func makeAllowance() -> TokenAllowance {
TokenAllowance(
tokenId: Resources.tokenId, ownerAccountId: Resources.accountId, spenderAccountId: testSpenderAccountId,
amount: 4)
}
internal func testSerialize() throws {
let allowance = Self.makeAllowance()
assertSnapshot(matching: allowance, as: .description)
}
internal func testFromProtobuf() throws {
let allowanceProto = Self.makeAllowance().toProtobuf()
let allowance = try TokenAllowance.fromProtobuf(allowanceProto)
assertSnapshot(matching: allowance, as: .description)
}
internal func testToProtobuf() throws {
let allowanceProto = Self.makeAllowance().toProtobuf()
assertSnapshot(matching: allowanceProto, as: .description)
}
}