go-waku/waku/v2/rest/debug_test.go

34 lines
630 B
Go
Raw Normal View History

package rest
import (
"bytes"
"context"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/require"
"github.com/waku-org/go-waku/waku/v2/node"
)
func TestGetV1Info(t *testing.T) {
2023-01-06 22:37:57 +00:00
wakuNode1, err := node.New()
require.NoError(t, err)
defer wakuNode1.Stop()
2023-01-06 22:37:57 +00:00
err = wakuNode1.Start(context.Background())
require.NoError(t, err)
d := &DebugService{
node: wakuNode1,
}
request, err := http.NewRequest(http.MethodPost, ROUTE_DEBUG_INFOV1, bytes.NewReader([]byte("")))
require.NoError(t, err)
rr := httptest.NewRecorder()
d.getV1Info(rr, request)
require.Equal(t, http.StatusOK, rr.Code)
}