Skip to content

Commit

Permalink
Add DownloadError Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nef10 committed Jul 3, 2022
1 parent bbfc9d9 commit c147009
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/minimum_coverage.txt
@@ -1 +1 @@
0
8
31 changes: 31 additions & 0 deletions Tests/RogersBankDownloaderTests/DownloadErrorTests.swift
@@ -0,0 +1,31 @@
@testable import RogersBankDownloader
import XCTest

final class DownloadErrorTests: XCTestCase {

func testDownloadErrorString() {
XCTAssertEqual(
"\(DownloadError.invalidJson(error: "ABC").localizedDescription)",
"The server response contained invalid JSON: ABC"
)
XCTAssertEqual(
"\(DownloadError.invalidParameters(parameters: ["a": "b", "c": "d"]).localizedDescription)",
"""
The give parameters could not be converted to JSON: ["c": "d", "a": "b"]
"""
)
XCTAssertEqual(
"\(DownloadError.httpError(error: "failed").localizedDescription)",
"An HTTP error occurred: failed"
)
XCTAssertEqual(
"\(DownloadError.noDataReceived.localizedDescription)",
"No data was received from the server"
)
XCTAssertEqual(
"\(DownloadError.invalidStatementNumber(-1).localizedDescription)",
"-1 is not a valid statement number to download"
)
}

}

0 comments on commit c147009

Please sign in to comment.