github.com/panekj/cli@v0.0.0-20230304125325-467dd2f3797e/cli/command/service/generic_resource_opts_test.go (about)

     1  package service
     2  
     3  import (
     4  	"testing"
     5  
     6  	"gotest.tools/v3/assert"
     7  	is "gotest.tools/v3/assert/cmp"
     8  )
     9  
    10  func TestValidateSingleGenericResource(t *testing.T) {
    11  	incorrect := []string{"foo", "fooo-bar"}
    12  	correct := []string{"foo=bar", "bar=1", "foo=barbar"}
    13  
    14  	for _, v := range incorrect {
    15  		_, err := ValidateSingleGenericResource(v)
    16  		assert.Check(t, is.ErrorContains(err, ""))
    17  	}
    18  
    19  	for _, v := range correct {
    20  		_, err := ValidateSingleGenericResource(v)
    21  		assert.NilError(t, err)
    22  	}
    23  }