From d303f72b813bb4887087078952c7ae3ce3e98154 Mon Sep 17 00:00:00 2001 From: Sai Venkat Desu Date: Fri, 21 Jun 2024 13:45:22 +0530 Subject: [PATCH] test: updated tests throwing errors to match expected errors --- SimpleKeychainTests/SimpleKeychainSpec.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SimpleKeychainTests/SimpleKeychainSpec.swift b/SimpleKeychainTests/SimpleKeychainSpec.swift index 29345bd..c167430 100644 --- a/SimpleKeychainTests/SimpleKeychainSpec.swift +++ b/SimpleKeychainTests/SimpleKeychainSpec.swift @@ -131,11 +131,15 @@ class SimpleKeychainTests: XCTestCase { } func testRetrievingNonExistingStringItem() { - XCTAssertThrowsError(try sut.string(forKey: "SHOULDNOTEXIST")) + XCTAssertThrowsError(try sut.string(forKey: "SHOULDNOTEXIST")) { error in + XCTAssertEqual(error as? SimpleKeychainError, .itemNotFound) + } } func testRetrievingNonExistingDataItem() { - XCTAssertThrowsError(try sut.data(forKey: "SHOULDNOTEXIST")) + XCTAssertThrowsError(try sut.data(forKey: "SHOULDNOTEXIST")) { error in + XCTAssertEqual(error as? SimpleKeychainError, .itemNotFound) + } } func testRetrievingStringItemThatCannotBeDecoded() {