Skip to content

Commit

Permalink
Merge pull request #314 from WalletConnect/test/#250-ping-integration…
Browse files Browse the repository at this point in the history
…-test

[Tests] Bugfix: #250: Re-enable ping integration test
  • Loading branch information
llbartekll authored Jul 7, 2022
2 parents 6e89bf7 + 029d1e4 commit e048eb4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
33 changes: 17 additions & 16 deletions Example/IntegrationTests/Sign/SignClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,23 @@ final class SignClientTests: XCTestCase {
}
wait(for: [sessionRejectExpectation], timeout: defaultTimeout)
}
//
// func testNewPairingPing() async {
// let responderReceivesPingResponseExpectation = expectation(description: "Responder receives ping response")
// await waitClientsConnected()
//
// let uri = try! await proposer.client.connect(requiredNamespaces: [:])!
//
// try! await responder.client.pair(uri: uri)
// let pairing = responder.client.getSettledPairings().first!
// responder.client.ping(topic: pairing.topic) { response in
// XCTAssertTrue(response.isSuccess)
// responderReceivesPingResponseExpectation.fulfill()
// }
// wait(for: [responderReceivesPingResponseExpectation], timeout: defaultTimeout)
// }
//

func testNewPairingPing() async throws {
let dapp = proposer!
let wallet = responder!
let pongResponseExpectation = expectation(description: "Ping sender receives a pong response")

let uri = try await dapp.client.connect(requiredNamespaces: ProposalNamespace.stubRequired())!
try await wallet.client.pair(uri: uri)

let pairing = wallet.client.getSettledPairings().first!
wallet.client.ping(topic: pairing.topic) { result in
if case .failure = result { XCTFail() }
pongResponseExpectation.fulfill()
}
wait(for: [pongResponseExpectation], timeout: defaultTimeout)
}

//
// func testNewSessionOnExistingPairing() async {
// await waitClientsConnected()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class NetworkInteractor: NetworkInteracting {

// TODO: Move to async
func respondSuccess(for payload: WCRequestSubscriptionPayload) {
Task {
Task(priority: .background) {
do {
try await respondSuccess(payload: payload)
} catch {
Expand Down

0 comments on commit e048eb4

Please sign in to comment.