From 48f3c0be6699229191161283298ca096770e9be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Heidekr=C3=BCger?= Date: Fri, 4 Oct 2024 14:19:09 -0700 Subject: [PATCH] Fix tests --- Tests/SpeziLLMTests/LLMOpenAIParameterTests+Enum.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Tests/SpeziLLMTests/LLMOpenAIParameterTests+Enum.swift b/Tests/SpeziLLMTests/LLMOpenAIParameterTests+Enum.swift index 31aaa09..4b61d7e 100644 --- a/Tests/SpeziLLMTests/LLMOpenAIParameterTests+Enum.swift +++ b/Tests/SpeziLLMTests/LLMOpenAIParameterTests+Enum.swift @@ -99,17 +99,17 @@ final class LLMOpenAIParameterEnumTests: XCTestCase { XCTAssertEqual(schema["description"] as? String, "Array Enum Parameter") XCTAssertEqual(schema["minItems"] as? Int, 1) XCTAssertEqual(schema["maxItems"] as? Int, 5) - XCTAssertFalse(schema["uniqueItems"] as? Bool) - XCTAssertEqual(items["type"] as? String, "string") - XCTAssertEqual(items["enum"] as? [String], CustomEnumType.allCases.map { $0.rawValue }) + XCTAssertFalse(schema["uniqueItems"] as? Bool ?? true) + XCTAssertEqual(items?["type"] as? String, "string") + XCTAssertEqual(items?["enum"] as? [String], CustomEnumType.allCases.map { $0.rawValue }) let schemaOptionalArrayEnum = try XCTUnwrap(llmFunction.schemaValueCollectors["optionalArrayEnumParameter"]) schema = schemaOptionalArrayEnum.schema.value items = schema["items"] as? [String: Any] XCTAssertEqual(schema["type"] as? String, "array") XCTAssertEqual(schema["description"] as? String, "Optional Array Enum Parameter") - XCTAssertEqual(items["type"] as? String, "string") - XCTAssertEqual(items["enum"] as? [String], CustomEnumType.allCases.map { $0.rawValue }) + XCTAssertEqual(items?["type"] as? String, "string") + XCTAssertEqual(items?["enum"] as? [String], CustomEnumType.allCases.map { $0.rawValue }) // Validate parameter injection let parameterData = try XCTUnwrap(