package invocation

import (
	"testing"

	"github.com/gin-gonic/gin"
	"github.com/stretchr/testify/require"
)

func TestRoutesExposeOnlyImmutableInvocationLifecycle(t *testing.T) {
	gin.SetMode(gin.TestMode)
	router := gin.New()
	RegisterRoutes(router, Dependencies{Service: &fakeService{}})
	got := make([]string, 0)
	for _, route := range router.Routes() {
		got = append(got, route.Method+" "+route.Path)
	}
	require.ElementsMatch(t, []string{
		"POST /api/v1/workspaces/:workspaceId/workflow/plans/:planId/invocations",
		"GET /api/v1/workspaces/:workspaceId/workflow/invocations",
		"GET /api/v1/workspaces/:workspaceId/workflow/invocations/:invocationId",
	}, got)
	for _, route := range got {
		require.NotContains(t, route, "DELETE")
		require.NotContains(t, route, "PATCH")
	}
}
