Files
GaCy-GO/internal/sdkserver/before_verify_test.go
T

22 lines
520 B
Go
Raw Normal View History

package sdkserver
import (
"encoding/json"
"net/http/httptest"
"testing"
)
func TestBeforeVerifyReturnsDataObject(t *testing.T) {
w := httptest.NewRecorder()
beforeVerifyReply(w)
var body struct {
Retcode int `json:"retcode"`
Data map[string]any `json:"data"`
}
if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil {
t.Fatal(err)
}
if w.Code != 200 || body.Retcode != 0 || body.Data == nil {
t.Fatalf("beforeVerify response cannot initialize SDK data: %s", w.Body.String())
}
}