package queryservice_test import ( "net/http" "net/http/httptest" "strings" "testing" queryservice "queryorchestration/api/queryService" "github.com/go-playground/validator/v10" "github.com/google/uuid" "github.com/labstack/echo/v4" "github.com/stretchr/testify/assert" ) func TestTriggerExport(t *testing.T) { e := echo.New() req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader("")) rec := httptest.NewRecorder() ctx := e.NewContext(req, rec) cons := queryservice.NewControllers(validator.New(), &queryservice.Services{}) err := cons.TriggerExport(ctx) assert.NoError(t, err) assert.Equal(t, http.StatusOK, rec.Code) assert.NotEmpty(t, rec.Body.String()) } func TestExportState(t *testing.T) { e := echo.New() req := httptest.NewRequest(http.MethodPost, "/", strings.NewReader("")) rec := httptest.NewRecorder() ctx := e.NewContext(req, rec) cons := queryservice.NewControllers(validator.New(), &queryservice.Services{}) id := uuid.New() err := cons.ExportState(ctx, id) assert.NoError(t, err) assert.Equal(t, http.StatusOK, rec.Code) assert.NotEmpty(t, rec.Body.String()) }