Documentation
¶
Overview ¶
Package test exposes test-only HTTP endpoints used by Cypress e2e against mk-go.
Every endpoint in this package is guarded by config.Config.TestMode. In production (TestMode=false) the routes are not registered at all, and any request to them returns the default Echo 404.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the HTTP handler for test-only endpoints.
func NewEchoHandler ¶
func NewEchoHandler() *Handler
NewEchoHandler constructs a Handler for the public `/api/test` endpoint.
**`/test` だけは `TestMode` で gate しない。** upstream は本番でも登録して おり、本家の backend e2e (`test/e2e/endpoints.ts`) がここを叩いて型変換と デフォルト値の挙動を確かめる。このパッケージの他の endpoint (`/reset-db` など) とは扱いが違うので、依存を持たない専用のコンストラクタを分けてある。
func NewHandler ¶
func NewHandler(db *gorm.DB, redisClient *redis.Client, metaRepo repository.MetaRepository, testMode bool) *Handler
NewHandler constructs a new test Handler.
db and redis are both required when testMode is true. They are accepted regardless so that test code that spins up a zero-value Handler cannot accidentally pass a nil dependency without it being caught by the runtime.