github.com/pluralsh/plural-cli@v0.9.5/pkg/api/recipes_test.go (about) 1 package api_test 2 3 import ( 4 "testing" 5 6 "github.com/pluralsh/gqlclient" 7 "github.com/pluralsh/plural-cli/pkg/api" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestConstructRecipe(t *testing.T) { 13 key := "key" 14 tests := []struct { 15 name string 16 input string 17 expected gqlclient.RecipeAttributes 18 }{ 19 { 20 name: `test ConstructRecipe method`, 21 expected: gqlclient.RecipeAttributes{ 22 OidcSettings: &gqlclient.OidcSettingsAttributes{ 23 DomainKey: &key, 24 }, 25 }, 26 input: ` 27 oidcSettings: 28 domainKey: "key" 29 `, 30 }, 31 } 32 for _, test := range tests { 33 t.Run(test.name, func(t *testing.T) { 34 repositoryAttributes, err := api.ConstructRecipe([]byte(test.input)) 35 assert.NoError(t, err) 36 assert.Equal(t, test.expected, repositoryAttributes) 37 }) 38 } 39 }