Skip to content

Commit

Permalink
fix: making filter admin data test order independent
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed Jan 15, 2024
1 parent 2f8e8bc commit 82e75fd
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tests/wakunode_rest/test_rest_admin.nim
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,6 @@ suite "Waku v2 Rest API - Admin":
pubsubTopicNode2 = DefaultPubsubTopic
pubsubTopicNode3 = PubsubTopic("/waku/2/custom-waku/proto")

expectedFilterData2 = fmt"(peerId: ""{$peerInfo2}"", filterCriteria:" &
fmt" @[(pubsubTopic: ""{pubsubTopicNode2}"", contentTopic: ""{contentFiltersNode2[0]}""), " &
fmt"(pubsubTopic: ""{pubsubTopicNode2}"", contentTopic: ""{contentFiltersNode2[1]}""), " &
fmt"(pubsubTopic: ""{pubsubTopicNode2}"", contentTopic: ""{contentFiltersNode2[2]}"")]"

expectedFilterData3 = fmt"(peerId: ""{$peerInfo3}"", filterCriteria:" &
fmt" @[(pubsubTopic: ""{pubsubTopicNode3}"", contentTopic: ""{contentFiltersNode3[0]}""), " &
fmt"(pubsubTopic: ""{pubsubTopicNode3}"", contentTopic: ""{contentFiltersNode3[1]}"")]"

let
subscribeResponse2 = await node2.wakuFilterClient.subscribe(
peerInfo1, pubsubTopicNode2, contentFiltersNode2
Expand All @@ -133,8 +124,16 @@ suite "Waku v2 Rest API - Admin":
getRes.status == 200
$getRes.contentType == $MIMETYPE_JSON
getRes.data.len() == 2
($getRes.data).contains(expectedFilterData2)
($getRes.data).contains(expectedFilterData3)

let
peers = @[getRes.data[0].peerId, getRes.data[1].peerId]
numCriteria = @[getRes.data[0].filterCriteria.len, getRes.data[1].filterCriteria.len]

check:
$peerInfo2 in peers
$peerInfo3 in peers
2 in numCriteria
3 in numCriteria

asyncTest "Get filter data - no filter subscribers":
await node1.mountFilter()
Expand Down

0 comments on commit 82e75fd

Please sign in to comment.