mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 04:20:17 +00:00
Cleaning up some coverage and a few bits.
This commit is contained in:
@@ -621,11 +621,17 @@ func TestConvertComponentIdIntoFriendlyPathSearch_Crazy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConvertComponentIdIntoFriendlyPathSearch_Simple(t *testing.T) {
|
||||
segment, path := ConvertComponentIdIntoFriendlyPathSearch("#//~1fresh~1pizza/get")
|
||||
assert.Equal(t, "$.['/fresh/pizza'].get", path)
|
||||
segment, path := ConvertComponentIdIntoFriendlyPathSearch("#/~1fresh~1pizza/get")
|
||||
assert.Equal(t, "$['/fresh/pizza'].get", path)
|
||||
assert.Equal(t, "get", segment)
|
||||
}
|
||||
|
||||
func TestConvertComponentIdIntoFriendlyPathSearch_Params(t *testing.T) {
|
||||
segment, path := ConvertComponentIdIntoFriendlyPathSearch("#/why/0")
|
||||
assert.Equal(t, "$.why[0]", path)
|
||||
assert.Equal(t, "0", segment)
|
||||
}
|
||||
|
||||
func TestConvertComponentIdIntoFriendlyPathSearch_Crazy_Github(t *testing.T) {
|
||||
segment, path := ConvertComponentIdIntoFriendlyPathSearch("#/paths/~1crazy~1ass~1references/get/responses/404/content/application~1xml;%20charset=utf-8/schema")
|
||||
assert.Equal(t, "$.paths['/crazy/ass/references'].get.responses['404'].content['application/xml; charset=utf-8'].schema", path)
|
||||
@@ -650,6 +656,12 @@ func TestConvertComponentIdIntoFriendlyPathSearch_CrazyShort(t *testing.T) {
|
||||
assert.Equal(t, "/crazy/ass/references", segment)
|
||||
}
|
||||
|
||||
func TestConvertComponentIdIntoFriendlyPathSearch_Short(t *testing.T) {
|
||||
segment, path := ConvertComponentIdIntoFriendlyPathSearch("/~1crazy~1ass~1references")
|
||||
assert.Equal(t, "$['/crazy/ass/references']", path)
|
||||
assert.Equal(t, "/crazy/ass/references", segment)
|
||||
}
|
||||
|
||||
func TestConvertComponentIdIntoFriendlyPathSearch_Array(t *testing.T) {
|
||||
segment, path := ConvertComponentIdIntoFriendlyPathSearch("#/paths/~1crazy~1ass~1references/get/parameters/0")
|
||||
assert.Equal(t, "$.paths['/crazy/ass/references'].get.parameters[0]", path)
|
||||
|
||||
Reference in New Issue
Block a user