Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zc2638 committed Dec 22, 2023
1 parent c099653 commit 66839db
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions endpoint/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,27 @@ type Model struct {
String string `json:"s"`
}

func TestBodyR(t *testing.T) {
expected := swag.Parameter{
In: "body",
Name: "body",
Required: true,
Schema: &swag.Schema{
Ref: "#/definitions/endpoint.Model",
Prototype: reflect.TypeOf(Model{}),
},
}

e := New(
"get", "/",
Summary("get thing"),
BodyR(Model{}),
)

assert.Equal(t, 1, len(e.Parameters))
assert.Equal(t, expected, e.Parameters[0])
}

func TestBody(t *testing.T) {
expected := swag.Parameter{
In: "body",
Expand Down

0 comments on commit 66839db

Please sign in to comment.