Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kcw-grunt committed Dec 13, 2024
1 parent a9cf77d commit ad63ebb
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 28 deletions.
8 changes: 4 additions & 4 deletions litewallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
24313CA523824F5800A83F69 /* Buy.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 24313C9823824F5800A83F69 /* Buy.storyboard */; };
24313CAA23824F9800A83F69 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 24313CA823824F9800A83F69 /* Main.storyboard */; };
24393B5C23C259400075218D /* Phrase.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 24393B5B23C259400075218D /* Phrase.storyboard */; };
24470E2123A5DA9700ADDA27 /* APIManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24470E2023A5DA9700ADDA27 /* APIManagerTests.swift */; };
24470E2123A5DA9700ADDA27 /* APITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24470E2023A5DA9700ADDA27 /* APITests.swift */; };
24470E2323A5DB7D00ADDA27 /* WalletManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24470E2223A5DB7D00ADDA27 /* WalletManagerTests.swift */; };
24470E2A23A5F33000ADDA27 /* BRReplicatedKVStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24470E2923A5F33000ADDA27 /* BRReplicatedKVStoreTests.swift */; };
24470E2C23A5F43B00ADDA27 /* DefaultFiatCurrencyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24470E2B23A5F43B00ADDA27 /* DefaultFiatCurrencyTests.swift */; };
Expand Down Expand Up @@ -733,7 +733,7 @@
24375314238AE09700E1B2AE /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = pt; path = pt.lproj/BIP39Words.plist; sourceTree = "<group>"; };
24375315238AE09900E1B2AE /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = ru; path = ru.lproj/BIP39Words.plist; sourceTree = "<group>"; };
24393B5B23C259400075218D /* Phrase.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Phrase.storyboard; sourceTree = "<group>"; };
24470E2023A5DA9700ADDA27 /* APIManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIManagerTests.swift; sourceTree = "<group>"; };
24470E2023A5DA9700ADDA27 /* APITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APITests.swift; sourceTree = "<group>"; };
24470E2223A5DB7D00ADDA27 /* WalletManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletManagerTests.swift; sourceTree = "<group>"; };
24470E2923A5F33000ADDA27 /* BRReplicatedKVStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRReplicatedKVStoreTests.swift; sourceTree = "<group>"; };
24470E2B23A5F43B00ADDA27 /* DefaultFiatCurrencyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultFiatCurrencyTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2096,7 +2096,7 @@
24470E3923A5FF5700ADDA27 /* TestHelpers.swift */,
24470E4323A6088700ADDA27 /* Class Tests */,
24470E2823A5F2C000ADDA27 /* Legacy BRTests */,
24470E2023A5DA9700ADDA27 /* APIManagerTests.swift */,
24470E2023A5DA9700ADDA27 /* APITests.swift */,
24470E2223A5DB7D00ADDA27 /* WalletManagerTests.swift */,
2465873A23A5AAD100A32E9E /* Info.plist */,
);
Expand Down Expand Up @@ -3908,7 +3908,7 @@
buildActionMask = 2147483647;
files = (
24470E4223A6007200ADDA27 /* WalletInfoTest.swift in Sources */,
24470E2123A5DA9700ADDA27 /* APIManagerTests.swift in Sources */,
24470E2123A5DA9700ADDA27 /* APITests.swift in Sources */,
24470E3423A5F5E600ADDA27 /* PaymentRequestTests.swift in Sources */,
584E25012951DAAA005E0E8B /* LanguageSelectionTests.swift in Sources */,
24470E2E23A5F4FF00ADDA27 /* BRCoderTests.swift in Sources */,
Expand Down
24 changes: 0 additions & 24 deletions litewalletTests/APIManagerTests.swift

This file was deleted.

43 changes: 43 additions & 0 deletions litewalletTests/APITests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@testable import litewallet
import XCTest

class APITests: XCTestCase {
var apiServer: APIServer!
var apiClient: BRAPIClient!

override func setUpWithError() throws {
apiServer = APIServer()
apiClient = litewallet.BRAPIClient(authenticator: NoAuthAuthenticator())
}

override func tearDownWithError() throws {
apiServer = nil
}

func testfetchExchangeRates() throws {
apiClient.exchangeRates { rates, _ in
for rate in rates {
if rate.code == "AFN" {
XCTAssertEqual(rate.name, "Afghan Afghani")
}
if rate.code == "GBP" {
XCTAssertEqual(rate.name, "British Pound Sterling")
}
if rate.code == "EUR" {
XCTAssertEqual(rate.name, "Euro")
}
if rate.code == "USD" {
XCTAssertEqual(rate.name, "US Dollar")
}
}
}
}

func testfeePerKb() throws {
apiClient.feePerKb { fees, _ in
XCTAssertGreaterThan(fees.economy, 0)
XCTAssertGreaterThan(fees.regular, 0)
XCTAssertGreaterThan(fees.luxury, 0)
}
}
}

0 comments on commit ad63ebb

Please sign in to comment.