From 7ec84469c237f05a835cec67b2ae8623ca78c087 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Fri, 19 Jul 2024 23:38:39 -0500 Subject: [PATCH] update some tests --- .../DocumentConversionTests.swift | 2 +- .../OpenAPIKitTests/Content/ContentTests.swift | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift b/Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift index 99617df42..fc0c42e31 100644 --- a/Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift +++ b/Tests/OpenAPIKitCompatTests/DocumentConversionTests.swift @@ -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) { diff --git a/Tests/OpenAPIKitTests/Content/ContentTests.swift b/Tests/OpenAPIKitTests/Content/ContentTests.swift index 72afe5a15..300bf67ee 100644 --- a/Tests/OpenAPIKitTests/Content/ContentTests.swift +++ b/Tests/OpenAPIKitTests/Content/ContentTests.swift @@ -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)))) ], @@ -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) @@ -397,7 +397,7 @@ extension ContentTests { content, OpenAPI.Content( schema: .init(.string), - encoding: ["json": .init(contentType: .json)] + encoding: ["json": .init(contentTypes: [.json])] ) ) } @@ -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) } @@ -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) @@ -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 {