From 7d709770c034d19a160f4d828155bae5bc698910 Mon Sep 17 00:00:00 2001 From: Artur Guseinov Date: Fri, 19 Jan 2024 11:52:01 +0300 Subject: [PATCH] RPCHistory tests resplved --- Sources/WalletConnectUtils/RPCHistory/RPCHistory.swift | 2 +- Tests/WalletConnectUtilsTests/RPCHistoryTests.swift | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Sources/WalletConnectUtils/RPCHistory/RPCHistory.swift b/Sources/WalletConnectUtils/RPCHistory/RPCHistory.swift index 44dfdad68..84f93768f 100644 --- a/Sources/WalletConnectUtils/RPCHistory/RPCHistory.swift +++ b/Sources/WalletConnectUtils/RPCHistory/RPCHistory.swift @@ -106,7 +106,7 @@ public final class RPCHistory { } } -private extension RPCHistory { +extension RPCHistory { func removeOutdated() { let records = storage.getAll() diff --git a/Tests/WalletConnectUtilsTests/RPCHistoryTests.swift b/Tests/WalletConnectUtilsTests/RPCHistoryTests.swift index 37b05ccdd..82becd7b8 100644 --- a/Tests/WalletConnectUtilsTests/RPCHistoryTests.swift +++ b/Tests/WalletConnectUtilsTests/RPCHistoryTests.swift @@ -35,10 +35,8 @@ final class RPCHistoryTests: XCTestCase { try sut.set(requestB, forTopic: String.randomTopic(), emmitedBy: .local) try sut.resolve(responseA) try sut.resolve(responseB) - let recordA = sut.get(recordId: requestA.id!) - let recordB = sut.get(recordId: requestB.id!) - XCTAssertEqual(recordA?.response, responseA) - XCTAssertEqual(recordB?.response, responseB) + XCTAssertNil(sut.get(recordId: requestA.id!)) + XCTAssertNil(sut.get(recordId: requestB.id!)) } func testDelete() throws { @@ -95,7 +93,7 @@ final class RPCHistoryTests: XCTestCase { } func testResolveDuplicateResponse() throws { - let expectedError = RPCHistory.HistoryError.responseDuplicateNotAllowed + let expectedError = RPCHistory.HistoryError.requestMatchingResponseNotFound let request = RPCRequest.stub() let responseA = RPCResponse(matchingRequest: request, result: true)