-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65d7100
commit f00b28d
Showing
7 changed files
with
74 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import XCTest | ||
@testable import SolanaSwift | ||
@testable import OrcaSwapSwift | ||
|
||
class PoolsTestsTests: XCTestCase { | ||
|
||
override func setUp() async throws {} | ||
|
||
func testGetInputAmount() async throws { | ||
let api = APIClient(configsProvider: MockConfigsProvider()) | ||
let pools = try await api.getPools() | ||
var pool = pools.values.first! | ||
pool.tokenABalance = .init(amount: 1, decimals: 1) | ||
pool.tokenBBalance = .init(amount: 2, decimals: 1) | ||
let estimatedAmount2: UInt64 = 1 | ||
let result = try pool.getInputAmount(fromEstimatedAmount: estimatedAmount2) | ||
XCTAssertEqual(result, 1) | ||
} | ||
|
||
func testGetBaseOutputAmount() async throws { | ||
let api = APIClient(configsProvider: MockConfigsProvider()) | ||
let pools = try await api.getPools() | ||
var pool = pools.values.first! | ||
pool.tokenABalance = .init(amount: 1, decimals: 1) | ||
pool.tokenBBalance = .init(amount: 2, decimals: 1) | ||
let result = try pool.getBaseOutputAmount(inputAmount: 1) | ||
XCTAssertEqual(result, 2) | ||
let result1 = try pool.getBaseOutputAmount(inputAmount: 2) | ||
XCTAssertEqual(result1, 4) | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.