31 lines
737 B
Go
31 lines
737 B
Go
|
|
package testkit
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"apps/backend/internal/domain"
|
||
|
|
|
||
|
|
"github.com/stretchr/testify/require"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestTestkit_EnvelopeHelpers(t *testing.T) {
|
||
|
|
c := TestConfig()
|
||
|
|
require.Equal(t, "haixun-test", c.Name)
|
||
|
|
require.Equal(t, int64(102000), domain.SuccessCode)
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestTestkit_HealthEnvelope(t *testing.T) {
|
||
|
|
// no monc/redis required — envelope helpers only
|
||
|
|
mux := NewTestMux(nil)
|
||
|
|
|
||
|
|
rr := DoGet(t, mux, "/api/v1/health")
|
||
|
|
require.Equal(t, http.StatusOK, rr.Code)
|
||
|
|
env := AssertEnvelope102000(t, rr.Body.Bytes())
|
||
|
|
require.NotNil(t, env.Data)
|
||
|
|
|
||
|
|
rr2 := DoGet(t, mux, "/api/v1/_not_implemented_probe")
|
||
|
|
require.Equal(t, http.StatusNotImplemented, rr2.Code)
|
||
|
|
AssertFailNotEmptySuccess(t, rr2.Body.Bytes())
|
||
|
|
}
|