Skip to content

Commit

Permalink
fix: conversion from bitswap record
Browse files Browse the repository at this point in the history
  • Loading branch information
2color committed Sep 25, 2024
1 parent 825d82f commit b6ed0dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions routing/http/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ func TestClient_FindProviders(t *testing.T) {
}

bitswapRecord := makeBitswapRecord()
bitswapProviders := []iter.Result[types.Record]{
{Val: &bitswapRecord},
}
peerRecordFromBitswapRecord := types.FromBitswapRecord(&bitswapRecord)

cases := []struct {
name string
Expand All @@ -254,8 +252,8 @@ func TestClient_FindProviders(t *testing.T) {
},
{
name: "happy case (with deprecated bitswap schema)",
routerResult: bitswapProviders,
expResult: bitswapProviders,
routerResult: []iter.Result[types.Record]{{Val: &bitswapRecord}},
expResult: []iter.Result[types.Record]{{Val: peerRecordFromBitswapRecord}},
expStreamingResponse: true,
},
{
Expand Down
1 change: 1 addition & 0 deletions routing/http/types/record_peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@ func FromBitswapRecord(br *BitswapRecord) *PeerRecord {
ID: br.ID,
Addrs: br.Addrs,
Protocols: []string{br.Protocol},
Extra: map[string]json.RawMessage{},
}
}

0 comments on commit b6ed0dc

Please sign in to comment.