package globalapi

import (
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestDetailIntegrationTaskInternal_RouteRegistered(t *testing.T) {
	w := httptest.NewRecorder()
	req, _ := http.NewRequest("GET", "/tidbcloud/v1beta1/internal/clusters/test-cluster-id/monitoringPipelines/test-task-id", nil)
	testEngine.ServeHTTP(w, req)

	// The route should be registered. A 404 means the route is not wired.
	// We expect a non-404 response (the handler will fail because no regional server
	// context is set up, but the important thing is the route exists).
	assert.NotEqual(t, http.StatusNotFound, w.Code, "internal detail integration task route should be registered")
}

func TestCreateIntegrationTaskInternal_RouteRegistered(t *testing.T) {
	w := httptest.NewRecorder()
	req, _ := http.NewRequest("POST", "/tidbcloud/v1beta1/internal/clusters/test-cluster-id/monitoringPipelines", nil)
	req.Header.Set("Content-Type", "application/json")
	testEngine.ServeHTTP(w, req)

	assert.NotEqual(t, http.StatusNotFound, w.Code, "internal create integration task route should be registered")
}
