import ( "testing" "github.com/nttlabs/cli/testhelpers/requirements" ) func TestMyCommand(t *testing.T) { reqFactory := requirements.NewFakeReqFactory() // Create a fake login requirement loginReq := reqFactory.NewLoginRequirement() // Pass fake requirement to CLI command being tested err := MyCommand(loginReq) if err != nil { t.Errorf("Unexpected error: %v", err) } }
import ( "testing" "github.com/nttlabs/cli/testhelpers/requirements" ) func TestMyCommand(t *testing.T) { reqFactory := requirements.NewFakeReqFactory() // Create a fake API endpoint requirement apiReq := reqFactory.NewAPIEndpointRequirement("https://example.com/api") // Pass fake requirement to CLI command being tested err := MyCommand(apiReq) if err != nil { t.Errorf("Unexpected error: %v", err) } }