package resources_test import ( "testing" "cloud.o-forge.io/core/oc-lib/models/utils" "cloud.o-forge.io/core/oc-lib/tools" "github.com/stretchr/testify/assert" "cloud.o-forge.io/core/oc-lib/models/resources" ) func TestWorkflowResource_GetType(t *testing.T) { w := &resources.WorkflowResource{} assert.Equal(t, tools.WORKFLOW_RESOURCE.String(), w.GetType()) } func TestWorkflowResource_ConvertToPricedResource(t *testing.T) { w := &resources.WorkflowResource{ AbstractResource: resources.AbstractResource{ AbstractObject: utils.AbstractObject{ Name: "Test Workflow", UUID: "workflow-uuid", CreatorID: "creator-id", }, Logo: "logo.png", }, } req := &tools.APIRequest{ PeerID: "peer-1", Groups: []string{"group1"}, } pr := w.ConvertToPricedResource(tools.WORKFLOW_RESOURCE, req) assert.Equal(t, "creator-id", pr.GetCreatorID()) assert.Equal(t, tools.WORKFLOW_RESOURCE, pr.GetType()) } func TestWorkflowResource_ClearEnv(t *testing.T) { w := &resources.WorkflowResource{} assert.Equal(t, w, w.ClearEnv()) } func TestWorkflowResource_Trim(t *testing.T) { w := &resources.WorkflowResource{} w.Trim() // nothing to assert; just test that it doesn't panic } func TestWorkflowResource_SetAllowedInstances(t *testing.T) { w := &resources.WorkflowResource{} w.SetAllowedInstances(&tools.APIRequest{}) // no-op; just confirm no crash } func TestWorkflowResource_GetAccessor(t *testing.T) { w := &resources.WorkflowResource{} request := &tools.APIRequest{} accessor := w.GetAccessor(request) assert.NotNil(t, accessor) }