Renamed other preAppbase GetAccountHistory method and added a test for testnet. (#21)

This commit is contained in:
Keith Hunter 2018-10-05 09:36:22 -04:00 committed by Iain Maitland
parent a4291384b5
commit 5c5cd69542
2 changed files with 13 additions and 2 deletions

View File

@ -225,7 +225,7 @@ public struct API {
public struct GetAccountHistory: Request, Encodable {
public typealias Response = [AccountHistoryObject]
public let method = "get_account_history"
public let method = "condenser_api.get_account_history"
public var params: RequestParams<AnyEncodable>? {
return RequestParams([AnyEncodable(self.account), AnyEncodable(self.from), AnyEncodable(self.limit)])
}

View File

@ -179,7 +179,7 @@ class ClientTest: XCTestCase {
}
func testGetAccountHistory() throws {
let req = API.GetAccountHistory(account: "almost-digital", from: 0, limit: 0)
let req = API.GetAccountHistory(account: "almost-digital", from: 1, limit: 1)
let result = try client.sendSynchronous(req)
guard let r = result?.first else {
XCTFail("No results returned")
@ -188,6 +188,17 @@ class ClientTest: XCTestCase {
let createOp = r.value.operation as? Steem.Operation.AccountCreateWithDelegation
XCTAssertEqual(createOp?.newAccountName, "almost-digital")
}
func testTestnetGetAccountHistory() throws {
let req = API.GetAccountHistory(account: "almost-digital", from: 1, limit: 1)
let result = try testnetClient.sendSynchronous(req)
guard let r = result?.first else {
XCTFail("No results returned")
return
}
let createOp = r.value.operation as? Steem.Operation.AccountCreate
XCTAssertEqual(createOp?.newAccountName, "almost-digital")
}
func testGetAccountHistoryVirtual() throws {
let req = API.GetAccountHistory(account: "almost-digital", from: 476, limit: 0)