Skip to content

Commit

Permalink
Add testChangingNonceWhenNewPendingTransactionIsAdded
Browse files Browse the repository at this point in the history
  • Loading branch information
vikmeup committed Aug 6, 2018
1 parent 00b2e0e commit c283f2e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion TrustTests/EtherClient/Providers/GetNonceProviderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class GetNonceProviderTests: XCTestCase {
XCTAssertEqual(BigInt(7), provider.nextNonce)
}

func testChangingNonceWhenNewTransactionAdded() {
func testChangingNonceWhenNewTransactionIsAdded() {
let storage = FakeTransactionsStorage()
storage.add([.make(nonce: 5)])
let provider = GetNonceProvider(
Expand All @@ -72,4 +72,22 @@ class GetNonceProviderTests: XCTestCase {
XCTAssertEqual(BigInt(6), provider.latestNonce)
XCTAssertEqual(BigInt(7), provider.nextNonce)
}

func testChangingNonceWhenNewPendingTransactionIsAdded() {
let storage = FakeTransactionsStorage()
storage.add([.make(nonce: 5)])
let provider = GetNonceProvider(
storage: storage,
server: .make(),
address: EthereumAddress.make()
)

XCTAssertEqual(BigInt(5), provider.latestNonce)
XCTAssertEqual(BigInt(6), provider.nextNonce)

storage.add([.make(nonce: 6, state: .pending)])

XCTAssertEqual(BigInt(6), provider.latestNonce)
XCTAssertEqual(BigInt(7), provider.nextNonce)
}
}

0 comments on commit c283f2e

Please sign in to comment.