package mail

import (
	"net/http"
	"testing"

	"github.com/go-chi/chi/v5"
)

func TestStoredAccountTestRouteRegistered(t *testing.T) {
	t.Parallel()

	h := NewHandlerWithService(&fakeMailService{})
	var found bool
	_ = chi.Walk(h.Routes(), func(method, route string, _ http.Handler, _ ...func(http.Handler) http.Handler) error {
		if method == http.MethodPost && route == "/accounts/{accountID}/test" {
			found = true
		}
		return nil
	})
	if !found {
		t.Fatal("POST /accounts/{accountID}/test route not registered")
	}
}
