Skip to content

Commit

Permalink
update peer_test to remove peer post and add api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Intizar-T committed Jun 26, 2024
1 parent c555380 commit ff29aa1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions node/pkg/boot/tests/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestSync(t *testing.T) {

func TestRefresh(t *testing.T) {
ctx := context.Background()
cleanup, testItems, err := setup(ctx)
cleanup, _, err := setup(ctx)
if err != nil {
t.Fatalf("error setting up test: %v", err)
}
Expand All @@ -89,14 +89,14 @@ func TestRefresh(t *testing.T) {
t.Fatalf("error extracting payload from host: %v", err)
}

res, err := adminTests.PostRequest[peer.PeerModel](testItems.app, "/api/v1/peer", peer.PeerInsertModel{
Url: url,
res, err := db.QueryRow[peer.PeerModel](ctx, peer.InsertPeer, map[string]any{
"url": url,
})
if err != nil {
t.Fatalf("error inserting peer: %v", err)
}

readResultBefore, err := adminTests.GetRequest[[]peer.PeerModel](testItems.app, "/api/v1/peer", nil)
readResultBefore, err := db.QueryRows[peer.PeerModel](ctx, peer.GetPeer, nil)
if err != nil {
t.Fatalf("error getting peers before: %v", err)
}
Expand All @@ -108,7 +108,7 @@ func TestRefresh(t *testing.T) {
t.Fatalf("error refreshing peers: %v", err)
}

readResultAfter, err := adminTests.GetRequest[[]peer.PeerModel](testItems.app, "/api/v1/peer", nil)
readResultAfter, err := db.QueryRows[peer.PeerModel](ctx, peer.GetPeer, nil)
if err != nil {
t.Fatalf("error getting peers after: %v", err)
}
Expand All @@ -122,7 +122,7 @@ func TestRefresh(t *testing.T) {
t.Fatalf("error refreshing peers: %v", err)
}

readResultFinal, err := adminTests.GetRequest[[]peer.PeerModel](testItems.app, "/api/v1/peer", nil)
readResultFinal, err := db.QueryRows[peer.PeerModel](ctx, peer.GetPeer, nil)
if err != nil {
t.Fatalf("error getting peers final: %v", err)
}
Expand Down

0 comments on commit ff29aa1

Please sign in to comment.