From 9ed957042fa781db9d81ea4936014f75693c2ff1 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Tue, 23 Apr 2024 10:29:29 -0500 Subject: [PATCH] clean up some temporary test code --- .../ExternalDereferencingDocumentTests.swift | 32 ------------ .../Path Item/PathItemTests.swift | 50 ------------------- 2 files changed, 82 deletions(-) diff --git a/Tests/OpenAPIKitTests/Document/ExternalDereferencingDocumentTests.swift b/Tests/OpenAPIKitTests/Document/ExternalDereferencingDocumentTests.swift index b063d048a..914e575cc 100644 --- a/Tests/OpenAPIKitTests/Document/ExternalDereferencingDocumentTests.swift +++ b/Tests/OpenAPIKitTests/Document/ExternalDereferencingDocumentTests.swift @@ -246,39 +246,7 @@ final class ExternalDereferencingDocumentTests: XCTestCase { try await docCopy3.externallyDereference(in: ExampleLoader.self, depth: .full) docCopy3.components.sort() -// print("-----") -// print(docCopy2 == docCopy3) -// print(docCopy2.components == docCopy3.components) -// print("+++++") -// print(docCopy2.components.schemas == docCopy3.components.schemas) -// print(docCopy2.components.responses == docCopy3.components.responses) -// print(docCopy2.components.parameters == docCopy3.components.parameters) -// print(docCopy2.components.examples == docCopy3.components.examples) -// print(docCopy2.components.requestBodies == docCopy3.components.requestBodies) -// print(docCopy2.components.headers == docCopy3.components.headers) -// print(docCopy2.components.securitySchemes == docCopy3.components.securitySchemes) -// print(docCopy2.components.links == docCopy3.components.links) -// print(docCopy2.components.callbacks == docCopy3.components.callbacks) -// print(docCopy2.components.pathItems == docCopy3.components.pathItems) -// print("=====") -// print(docCopy2.components.responses) -// print("&&&&&") -// print(docCopy3.components.responses) -// print("$$$$$") - XCTAssertEqual(docCopy1, docCopy2) XCTAssertEqual(docCopy2, docCopy3) -// XCTAssertEqual(String(describing: docCopy2), String(describing: docCopy3)) - - // - MARK: After -// print( -// String(data: try encoder.encode(docCopy1), encoding: .utf8)! -// ) -// print( -// String(data: try encoder.encode(docCopy2), encoding: .utf8)! -// ) -// print( -// String(data: try encoder.encode(docCopy3), encoding: .utf8)! -// ) } } diff --git a/Tests/OpenAPIKitTests/Path Item/PathItemTests.swift b/Tests/OpenAPIKitTests/Path Item/PathItemTests.swift index 62ddd9a83..22c9e2601 100644 --- a/Tests/OpenAPIKitTests/Path Item/PathItemTests.swift +++ b/Tests/OpenAPIKitTests/Path Item/PathItemTests.swift @@ -433,53 +433,3 @@ extension PathItemTests { ) } } - -// MARK: External Dereferencing Tests -extension PathItemTests { - struct MockLoad: ExternalLoader { - static func componentKey(type: T.Type, at url: URL) throws -> OpenAPI.ComponentKey { - let urlString = url.pathComponents.dropFirst().joined(separator: "_").replacingOccurrences(of: ".", with: "_") - - return try .forceInit(rawValue: urlString) - } - - static func load(_: URL) throws -> T where T : Decodable { - if let ret = OpenAPI.Request(description: "hello", content: [:]) as? T { - return ret - } - if let ret = OpenAPI.Parameter(name: "other-param", context: .header, schema: .string) as? T { - return ret - } - throw ValidationError(reason: "", at: []) - } - } - - func test_tmp() async throws { - let op = OpenAPI.Operation(responses: [:]) - let pathItem = OpenAPI.PathItem( - summary: "summary", - description: "description", - servers: [OpenAPI.Server(url: URL(string: "http://google.com")!)], - parameters: [ - .parameter(name: "hello", context: .query, schema: .string), - .reference(.component(named: "already-internal")), - .reference(.external(URL(string: "https://some-param.com/param")!)) - ], - get: .init(requestBody: .reference(.external(URL(string: "https://website.com/request")!)), responses: [:]), - put: op, - post: op, - delete: op, - options: op, - head: op, - patch: op, - trace: op - ) - - print(pathItem.parameters.debugDescription) - print("------") - let (x, loaderComponents) = try await pathItem.externallyDereferenced(with: MockLoad.self) - print(x.parameters.debugDescription) - print("=======") - print(loaderComponents.parameters) - } -}