Skip to content

Commit

Permalink
test: add real world test case
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Sep 26, 2024
1 parent 61b5def commit f13c862
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions routing/http/server/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,24 @@ func TestProtocolsAllowed(t *testing.T) {
filterProtocols: []string{"unknown"},
expected: false,
},
{
name: "Unknown or specific protocol for matching non-empty peer protocols",
peerProtocols: []string{"transport-bitswap"},
filterProtocols: []string{"unknown", "transport-bitswap", "transport-ipfs-gateway-http"},
expected: true,
},
{
name: "Unknown or specific protocol for matching empty peer protocols",
peerProtocols: []string{},
filterProtocols: []string{"unknown", "transport-bitswap", "transport-ipfs-gateway-http"},
expected: true,
},
{
name: "Unknown or specific protocol for not matching non-empty peer protocols",
peerProtocols: []string{"transport-graphsync-filecoinv1"},
filterProtocols: []string{"unknown", "transport-bitswap", "transport-ipfs-gateway-http"},
expected: false,
},
{
name: "Case insensitive match",
peerProtocols: []string{"TRANSPORT-BITSWAP", "Transport-IPFS-Gateway-HTTP"},
Expand Down

0 comments on commit f13c862

Please sign in to comment.