Skip to content

Commit

Permalink
fix pubsub tests (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
chertby authored Sep 8, 2024
1 parent e9ab7b5 commit 036fea7
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ public async Task Test_Peer_is_dialed_when_added_by_discovery()

TestDiscoveryProtocol discovery = new();
CancellationToken token = default;
TaskCompletionSource taskCompletionSource = new();

_ = router.RunAsync(peer, discovery, token: token);
discovery.OnAddPeer!([discoveredPeer]);

await Task.Delay(100);
_ = peer.Received().DialAsync(discoveredPeer, Arg.Any<CancellationToken>());

router.OutboundConnection(discoveredPeer, PubsubRouter.FloodsubProtocolVersion, Task.CompletedTask, (rpc) => { });
router.OutboundConnection(discoveredPeer, PubsubRouter.FloodsubProtocolVersion, taskCompletionSource.Task, (rpc) => { });
Assert.That(state.ConnectedPeers, Has.Member(peerId));
taskCompletionSource.SetResult();
}
}

0 comments on commit 036fea7

Please sign in to comment.