Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenBakker-wbd committed Aug 28, 2023
1 parent ab7dda9 commit 46e6df3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ jobs:
-Dsonar.organization=jeroenbakker-wbd
-Dsonar.projectKey=JeroenBakker-wbd_FlickrFinder
-Dsonar.sources=Data/,Domain/,Presentation/,FlickrFinder/
-Dsonar.tests=DataTests/
-Dsonar.tests=Data/Tests/,Domain/Tests/
-Dsonar.swift.project=FlickrFinder.xcodeproj
-Dsonar.swift.scheme=FlickrFinder
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.token=$SONAR_TOKEN
-Dsonar.coverageReportPaths=coverage.xml
-Dsonar.coverage.exclusions=DataTests/
-Dsonar.coverage.exclusions=Data/Tests/,Domain/Tests/
-Dsonar.c.file.suffixes=-
-Dsonar.cpp.file.suffixes=-
-Dsonar.objc.file.suffixes=-
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

enum FlickrSearchPhotoError: Error {
enum FlickrSearchPhotoError: Error, Equatable {
case api(FlickrAPIError)
case tooManyTags
case unknownUser
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Created by Jeroen Bakker on 28/08/2023.
// Copyright (c) 2023 Bleacher Report. All rights reserved.
//

import XCTest
@testable import Data

final class FlickrSearchPhotoErrorTests: XCTestCase {

func test_init_onUnsupportedInput_shouldReturnAPIEnum() throws {
// given
let input = 0

// when
let result = FlickrSearchPhotoError(rawValue: input)

// then
if case .api(let flickrAPIError) = result {
XCTAssertEqual(.unknown, flickrAPIError)
} else {
XCTFail()
}
}

func test_Init_onSupportedInputs_shouldReturnEnum() throws {
// given
let inputs = [1, 2, 3, 4, 5]
let expectedResults: [FlickrSearchPhotoError] = [
.tooManyTags,
.unknownUser,
.parameterlessSearchesDisabled,
.noPermission,
.userDeleted
]

for (index, input) in inputs.enumerated() {
// when
let result = FlickrSearchPhotoError(rawValue: input)
// then
XCTAssertEqual(expectedResults[index], result)
}
}
}

0 comments on commit 46e6df3

Please sign in to comment.