mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-08 04:20:17 +00:00
fix: continued moving everything to orderedmaps plus cleaned up most the tests
This commit is contained in:
@@ -9,10 +9,14 @@ import (
|
||||
|
||||
"github.com/pb33f/libopenapi/datamodel/high/base"
|
||||
"github.com/pb33f/libopenapi/orderedmap"
|
||||
"github.com/pb33f/libopenapi/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
func TestParameter_MarshalYAML(t *testing.T) {
|
||||
ext := orderedmap.New[string, *yaml.Node]()
|
||||
ext.Set("x-burgers", utils.CreateStringNode("why not?"))
|
||||
|
||||
explode := true
|
||||
param := Parameter{
|
||||
@@ -23,11 +27,11 @@ func TestParameter_MarshalYAML(t *testing.T) {
|
||||
Style: "simple",
|
||||
Explode: &explode,
|
||||
AllowReserved: true,
|
||||
Example: "example",
|
||||
Example: utils.CreateStringNode("example"),
|
||||
Examples: orderedmap.ToOrderedMap(map[string]*base.Example{
|
||||
"example": {Value: "example"},
|
||||
"example": {Value: utils.CreateStringNode("example")},
|
||||
}),
|
||||
Extensions: map[string]interface{}{"x-burgers": "why not?"},
|
||||
Extensions: ext,
|
||||
}
|
||||
|
||||
rend, _ := param.Render()
|
||||
@@ -49,6 +53,8 @@ x-burgers: why not?`
|
||||
}
|
||||
|
||||
func TestParameter_MarshalYAMLInline(t *testing.T) {
|
||||
ext := orderedmap.New[string, *yaml.Node]()
|
||||
ext.Set("x-burgers", utils.CreateStringNode("why not?"))
|
||||
|
||||
explode := true
|
||||
param := Parameter{
|
||||
@@ -59,11 +65,11 @@ func TestParameter_MarshalYAMLInline(t *testing.T) {
|
||||
Style: "simple",
|
||||
Explode: &explode,
|
||||
AllowReserved: true,
|
||||
Example: "example",
|
||||
Example: utils.CreateStringNode("example"),
|
||||
Examples: orderedmap.ToOrderedMap(map[string]*base.Example{
|
||||
"example": {Value: "example"},
|
||||
"example": {Value: utils.CreateStringNode("example")},
|
||||
}),
|
||||
Extensions: map[string]interface{}{"x-burgers": "why not?"},
|
||||
Extensions: ext,
|
||||
}
|
||||
|
||||
rend, _ := param.RenderInline()
|
||||
@@ -85,7 +91,6 @@ x-burgers: why not?`
|
||||
}
|
||||
|
||||
func TestParameter_IsExploded(t *testing.T) {
|
||||
|
||||
explode := true
|
||||
param := Parameter{
|
||||
Explode: &explode,
|
||||
@@ -106,7 +111,6 @@ func TestParameter_IsExploded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParameter_IsDefaultFormEncoding(t *testing.T) {
|
||||
|
||||
param := Parameter{}
|
||||
assert.True(t, param.IsDefaultFormEncoding())
|
||||
|
||||
@@ -133,7 +137,6 @@ func TestParameter_IsDefaultFormEncoding(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParameter_IsDefaultHeaderEncoding(t *testing.T) {
|
||||
|
||||
param := Parameter{}
|
||||
assert.True(t, param.IsDefaultHeaderEncoding())
|
||||
|
||||
@@ -163,8 +166,6 @@ func TestParameter_IsDefaultHeaderEncoding(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParameter_IsDefaultPathEncoding(t *testing.T) {
|
||||
|
||||
param := Parameter{}
|
||||
assert.True(t, param.IsDefaultPathEncoding())
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user