Files
libopenapi/datamodel/high/v3/server_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
824 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 TestServer_MarshalYAML(t *testing.T) {
server := &Server{
URL: "https://pb33f.io",
Description: "the b33f",
}
desired := `url: https://pb33f.io
description: the b33f`
rend, _ := server.Render()
assert.Equal(t, desired, strings.TrimSpace(string(rend)))
// mutate
server.Variables = map[string]*ServerVariable{
"rainbow": {
Enum: []string{"one", "two", "three"},
},
}
desired = `url: https://pb33f.io
description: the b33f
variables:
rainbow:
enum:
- one
- two
- three`
rend, _ = server.Render()
assert.Equal(t, desired, strings.TrimSpace(string(rend)))
}