Skip to content

Commit

Permalink
add testDisconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
llbartekll committed Dec 6, 2023
1 parent 019c591 commit ee62513
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
31 changes: 17 additions & 14 deletions Example/IntegrationTests/Pairing/PairingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,21 @@ final class PairingTests: XCTestCase {

wait(for: [expectation], timeout: InputConfig.defaultTimeout)
}
//
// func testDisconnect() {
//
// let expectation = expectation(description: "wallet responds unsupported method for unregistered method")
//
// appAuthClient.authResponsePublisher.sink { (_, response) in
// XCTAssertEqual(response, .failure(AuthError(code: 10001)!))
// expectation.fulfill()
// }.store(in: &publishers)
//
// let uri = try! await appPairingClient.create()
//
// try? await walletPairingClient.pair(uri: uri)
// }

func testDisconnect() async {

let expectation = expectation(description: "wallet disconnected pairing")


walletPairingClient.pairingDeletePublisher.sink { _ in
expectation.fulfill()
}.store(in: &publishers)

let uri = try! await appPairingClient.create()

try? await walletPairingClient.pair(uri: uri)

try! await appPairingClient.disconnect(topic: uri.topic)
wait(for: [expectation], timeout: InputConfig.defaultTimeout)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ class PairingDeleteRequester {
func delete(topic: String) async throws {
let reason = PairingReasonCode.userDisconnected
let protocolMethod = PairingProtocolMethod.delete
let pairingDeleteParams = PairingDeleteParams(code: reason.code, message: reason.message)
logger.debug("Will delete pairing for reason: message: \(reason.message) code: \(reason.code)")
let request = RPCRequest(method: protocolMethod.method, params: reason)
let request = RPCRequest(method: protocolMethod.method, params: pairingDeleteParams)
try await networkingInteractor.request(request, topic: topic, protocolMethod: protocolMethod)
pairingStorage.delete(topic: topic)
kms.deleteSymmetricKey(for: topic)
Expand Down

0 comments on commit ee62513

Please sign in to comment.