mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
Add tests for remainder of MASError
This commit is contained in:
parent
9347b44547
commit
47dfe5e222
1 changed files with 48 additions and 3 deletions
|
@ -29,7 +29,8 @@ class MASErrorTestCase: XCTestCase {
|
|||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
nserror = NSError(domain: errorDomain, code: 999) //, userInfo: ["NSLocalizedDescriptionKey": "foo"])
|
||||
nserror = NSError(domain: errorDomain, code: 999)
|
||||
localizedDescription = "foo"
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
|
@ -49,8 +50,52 @@ class MASErrorTestCase: XCTestCase {
|
|||
}
|
||||
|
||||
func testSignInFailedError() {
|
||||
localizedDescription = "foo"
|
||||
error = .signInFailed(error: nserror)
|
||||
XCTAssertEqual("Sign in failed: foo", error.description)
|
||||
XCTAssertEqual(error.description, "Sign in failed: foo")
|
||||
}
|
||||
|
||||
func testAlreadySignedIn() {
|
||||
error = .alreadySignedIn
|
||||
XCTAssertEqual(error.description, "Already signed in")
|
||||
}
|
||||
|
||||
func testPurchaseFailed() {
|
||||
error = .purchaseFailed(error: nil)
|
||||
XCTAssertEqual(error.description, "Download request failed")
|
||||
}
|
||||
|
||||
func testPurchaseFailedError() {
|
||||
error = .purchaseFailed(error: nserror)
|
||||
XCTAssertEqual(error.description, "Download request failed: foo")
|
||||
}
|
||||
|
||||
func testDownloadFailed() {
|
||||
error = .downloadFailed(error: nil)
|
||||
XCTAssertEqual(error.description, "Download failed")
|
||||
}
|
||||
|
||||
func testDownloadFailedError() {
|
||||
error = .downloadFailed(error: nserror)
|
||||
XCTAssertEqual(error.description, "Download failed: foo")
|
||||
}
|
||||
|
||||
func testNoDownloads() {
|
||||
error = .noDownloads
|
||||
XCTAssertEqual(error.description, "No downloads began")
|
||||
}
|
||||
|
||||
func testCancelled() {
|
||||
error = .cancelled
|
||||
XCTAssertEqual(error.description, "Download cancelled")
|
||||
}
|
||||
|
||||
func testSearchFailed() {
|
||||
error = .searchFailed
|
||||
XCTAssertEqual(error.description, "Search failed")
|
||||
}
|
||||
|
||||
func testNoSearchResultsFound() {
|
||||
error = .noSearchResultsFound
|
||||
XCTAssertEqual(error.description, "No results found")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue