From 11a06ed3d27aa8156b3e7fa6cd5e6d032cc078d6 Mon Sep 17 00:00:00 2001 From: Marek Stransky Date: Fri, 12 Jan 2024 16:38:50 +0100 Subject: [PATCH] Improve deserialization test conditions --- .../NetworkingObjectsTests.swift | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/WultraMobileTokenSDKTests/NetworkingObjectsTests.swift b/WultraMobileTokenSDKTests/NetworkingObjectsTests.swift index 87ce5a4..839cbac 100644 --- a/WultraMobileTokenSDKTests/NetworkingObjectsTests.swift +++ b/WultraMobileTokenSDKTests/NetworkingObjectsTests.swift @@ -378,8 +378,21 @@ class NetworkingObjectsTests: XCTestCase { XCTFail("Failed to parse JSON data") return } - - XCTAssert(result.responseObject?[0].formData.attributes.isEmpty == false, "There should be a Conversion Attribute, but attributes are empty.") + + guard let attributes = result.responseObject?[0].formData.attributes else { + XCTFail("Failed to get attributes") + return + } + + XCTAssertFalse(attributes.count == 0, "There should be a Conversion Attribute, but attributes are empty.") + XCTAssertFalse(attributes.count > 1, "There should be only a Conversion Attribute, so the amount attribute deserialization changed so also this test should change") + + if let conversion = attributes.first as? WMTOperationAttributeAmountConversion { + XCTAssertEqual(conversion.type, .amountConversion, "The First attribute should be a Conversion Attribute.") + } else { + XCTFail("Failed to cast to WMTOperationAttributeAmountConversion") + } + } }