From 557d735bc46d0382123393f6b09df5c899b980c3 Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Wed, 2 Jan 2019 11:52:52 +0100 Subject: [PATCH] =?UTF-8?q?Refactor=20`RelationshipsTest`=E2=80=99s=20`fun?= =?UTF-8?q?c=20testDecoder()`=20to=20not=20crash=20the=20process=20on=20fa?= =?UTF-8?q?ilure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tests/XMLCoderTests/RelationshipsTest.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tests/XMLCoderTests/RelationshipsTest.swift b/Tests/XMLCoderTests/RelationshipsTest.swift index 767ec575..550da4fd 100644 --- a/Tests/XMLCoderTests/RelationshipsTest.swift +++ b/Tests/XMLCoderTests/RelationshipsTest.swift @@ -51,7 +51,13 @@ final class RelationshipsTest: XCTestCase { let rels = try decoder.decode(Relationships.self, from: xml) - XCTAssertEqual(rels.items[0].id, "rId1") + XCTAssertEqual(rels.items.count, 3) + + guard let relationship = rels.items.first else { + return + } + + XCTAssertEqual(relationship.id, "rId1") } static var allTests = [