Skip to content

Commit

Permalink
update some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin committed Jul 20, 2024
1 parent d11fe0c commit 7ec8446
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ fileprivate func assertEqualNewToOld(_ newExample: OpenAPIKit.OpenAPI.Example, _
}

fileprivate func assertEqualNewToOld(_ newEncoding: OpenAPIKit.OpenAPI.Content.Encoding, _ oldEncoding: OpenAPIKit30.OpenAPI.Content.Encoding) throws {
XCTAssertEqual(newEncoding.contentType, oldEncoding.contentType)
XCTAssertEqual(newEncoding.contentTypes.first, oldEncoding.contentType)
if let newEncodingHeaders = newEncoding.headers {
let oldEncodingHeaders = try XCTUnwrap(oldEncoding.headers)
for ((newKey, newHeader), (oldKey, oldHeader)) in zip(newEncodingHeaders, oldEncodingHeaders) {
Expand Down
18 changes: 9 additions & 9 deletions Tests/OpenAPIKitTests/Content/ContentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class ContentTests: XCTestCase {
example: nil,
encoding: [
"hello": .init(
contentType: .json,
contentTypes: [.json],
headers: [
"world": .init(OpenAPI.Header(schemaOrContent: .init(.header(.string))))
],
Expand Down Expand Up @@ -355,7 +355,7 @@ extension ContentTests {
func test_encodingAndSchema_encode() {
let content = OpenAPI.Content(
schema: .init(.string),
encoding: ["json": .init(contentType: .json)]
encoding: ["json": .init(contentTypes: [.json])]
)
let encodedContent = try! orderUnstableTestStringFromEncoding(of: content)

Expand Down Expand Up @@ -397,7 +397,7 @@ extension ContentTests {
content,
OpenAPI.Content(
schema: .init(.string),
encoding: ["json": .init(contentType: .json)]
encoding: ["json": .init(contentTypes: [.json])]
)
)
}
Expand Down Expand Up @@ -500,18 +500,18 @@ extension ContentTests {
func test_encodingInit() {
let _ = OpenAPI.Content.Encoding()

let _ = OpenAPI.Content.Encoding(contentType: .json)
let _ = OpenAPI.Content.Encoding(contentTypes: [.json])

let _ = OpenAPI.Content.Encoding(headers: ["special": .a(.external(URL(string: "hello.yml")!))])

let _ = OpenAPI.Content.Encoding(allowReserved: true)

let _ = OpenAPI.Content.Encoding(contentType: .form,
let _ = OpenAPI.Content.Encoding(contentTypes: [.form],
headers: ["special": .a(.external(URL(string: "hello.yml")!))],
allowReserved: true)
let _ = OpenAPI.Content.Encoding(contentType: .json,
let _ = OpenAPI.Content.Encoding(contentTypes: [.json],
style: .form)
let _ = OpenAPI.Content.Encoding(contentType: .json,
let _ = OpenAPI.Content.Encoding(contentTypes: [.json],
style: .form,
explode: true)
}
Expand Down Expand Up @@ -544,7 +544,7 @@ extension ContentTests {
}

func test_encoding_contentType_encode() throws {
let encoding = OpenAPI.Content.Encoding(contentType: .csv)
let encoding = OpenAPI.Content.Encoding(contentTypes: [.csv])

let encodedEncoding = try! orderUnstableTestStringFromEncoding(of: encoding)

Expand All @@ -567,7 +567,7 @@ extension ContentTests {
""".data(using: .utf8)!
let encoding = try! orderUnstableDecode(OpenAPI.Content.Encoding.self, from: encodingData)

XCTAssertEqual(encoding, OpenAPI.Content.Encoding(contentType: .csv))
XCTAssertEqual(encoding, OpenAPI.Content.Encoding(contentTypes: [.csv]))
}

func test_encoding_multiple_contentTypes_encode() throws {
Expand Down

0 comments on commit 7ec8446

Please sign in to comment.