Skip to content

Commit

Permalink
Add an escaped path component test case (#49)
Browse files Browse the repository at this point in the history
### Motivation

While investigating
apple/swift-openapi-generator#251 I noticed we
don't have a test case for an escaped path component.

### Modifications

Added an extra test case.

### Result

Unescaping path params has better test coverage.

### Test Plan

This whole PR is about improving the tests.
  • Loading branch information
czechboy0 authored Sep 7, 2023
1 parent f0589f6 commit 9b003cc
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ final class Test_ServerConverterExtensions: Test_Runtime {
"foo": "bar",
"number": "1",
"habitats": "land,air",
"withEscaping": "Hello%20world%21",
]
do {
let value = try converter.getPathParameterAsURI(
Expand All @@ -150,6 +151,14 @@ final class Test_ServerConverterExtensions: Test_Runtime {
)
XCTAssertEqual(value, [.land, .air])
}
do {
let value = try converter.getPathParameterAsURI(
in: path,
name: "withEscaping",
as: String.self
)
XCTAssertEqual(value, "Hello world!")
}
}

// | server | get | request query | URI | optional | getOptionalQueryItemAsURI |
Expand Down

0 comments on commit 9b003cc

Please sign in to comment.