thread-master/apps/backend/internal/testkit/testkit_test.go

31 lines
737 B
Go
Raw Permalink Normal View History

2026-07-10 12:54:45 +00:00
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())
}