23 lines
520 B
Go
23 lines
520 B
Go
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())
|
|
}
|
|
}
|