mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
Add appID
parameter to MASError.notInstalled()
.
Partial #313 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
222646159d
commit
b0d2f23465
5 changed files with 9 additions and 9 deletions
|
@ -30,7 +30,7 @@ extension Mas {
|
|||
func run(appLibrary: AppLibrary) throws {
|
||||
let installedApps = appLibrary.installedApps(withAppID: appID)
|
||||
guard !installedApps.isEmpty else {
|
||||
throw MASError.notInstalled
|
||||
throw MASError.notInstalled(appID: appID)
|
||||
}
|
||||
|
||||
if dryRun {
|
||||
|
|
|
@ -27,7 +27,7 @@ enum MASError: Error, Equatable {
|
|||
case noSearchResultsFound
|
||||
case noVendorWebsite
|
||||
|
||||
case notInstalled
|
||||
case notInstalled(appID: AppID)
|
||||
case uninstallFailed
|
||||
|
||||
case noData
|
||||
|
@ -80,8 +80,8 @@ extension MASError: CustomStringConvertible {
|
|||
return "No results found"
|
||||
case .noVendorWebsite:
|
||||
return "App does not have a vendor website"
|
||||
case .notInstalled:
|
||||
return "Not installed"
|
||||
case .notInstalled(let appID):
|
||||
return "No apps installed with app ID \(appID)"
|
||||
case .uninstallFailed:
|
||||
return "Uninstall failed"
|
||||
case .noData:
|
||||
|
|
|
@ -38,7 +38,7 @@ public class UninstallSpec: QuickSpec {
|
|||
expect {
|
||||
try uninstall.run(appLibrary: mockLibrary)
|
||||
}
|
||||
.to(throwError(MASError.notInstalled))
|
||||
.to(throwError(MASError.notInstalled(appID: appID)))
|
||||
}
|
||||
it("finds an app") {
|
||||
mockLibrary.installedApps.append(app)
|
||||
|
@ -58,7 +58,7 @@ public class UninstallSpec: QuickSpec {
|
|||
expect {
|
||||
try uninstall.run(appLibrary: mockLibrary)
|
||||
}
|
||||
.to(throwError(MASError.notInstalled))
|
||||
.to(throwError(MASError.notInstalled(appID: appID)))
|
||||
}
|
||||
it("removes an app") {
|
||||
mockLibrary.installedApps.append(app)
|
||||
|
|
|
@ -15,7 +15,7 @@ class AppLibraryMock: AppLibrary {
|
|||
if !installedApps.contains(where: { product -> Bool in
|
||||
app.itemIdentifier == product.itemIdentifier
|
||||
}) {
|
||||
throw MASError.notInstalled
|
||||
throw MASError.notInstalled(appID: app.itemIdentifier.appIDValue)
|
||||
}
|
||||
|
||||
// Special case for testing where we pretend the trash command failed
|
||||
|
|
|
@ -109,8 +109,8 @@ class MASErrorTestCase: XCTestCase {
|
|||
}
|
||||
|
||||
func testNotInstalled() {
|
||||
error = .notInstalled
|
||||
XCTAssertEqual(error.description, "Not installed")
|
||||
error = .notInstalled(appID: 123)
|
||||
XCTAssertEqual(error.description, "No apps installed with app ID 123")
|
||||
}
|
||||
|
||||
func testUninstallFailed() {
|
||||
|
|
Loading…
Reference in a new issue