Files
libopenapi/datamodel/high/v3/server_variable_test.go
Dave Shanley c3cf5f1e38 Added support for unevaluatedProperties as Schema and bool #118
Also ran `gofmt` across the entire project. Things need cleaning up.

Signed-off-by: Dave Shanley <dave@quobix.com>
2023-06-17 14:12:27 -04:00

44 lines
753 B
Go

// Copyright 2023 Princess B33f Heavy Industries / Dave Shanley
// SPDX-License-Identifier: MIT
package v3
import (
"github.com/stretchr/testify/assert"
"strings"
"testing"
)
func TestServerVariable_MarshalYAML(t *testing.T) {
svar := &ServerVariable{
Enum: []string{"one", "two", "three"},
Description: "money day",
}
desired := `enum:
- one
- two
- three
description: money day`
svarRend, _ := svar.Render()
assert.Equal(t, desired, strings.TrimSpace(string(svarRend)))
// mutate
svar.Default = "is moments away"
desired = `enum:
- one
- two
- three
default: is moments away
description: money day`
svarRend, _ = svar.Render()
assert.Equal(t, desired, strings.TrimSpace(string(svarRend)))
}