mirror of
https://github.com/mas-cli/mas
synced 2024-11-25 13:00:23 +00:00
cc219fe644
Rename `AppLibraryMock` as `MockAppLibrary`. Partial #585 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
28 lines
719 B
Swift
28 lines
719 B
Swift
//
|
|
// MockAppLibrary.swift
|
|
// masTests
|
|
//
|
|
// Created by Ben Chatelain on 12/27/18.
|
|
// Copyright © 2018 mas-cli. All rights reserved.
|
|
//
|
|
|
|
@testable import mas
|
|
|
|
class MockAppLibrary: AppLibrary {
|
|
var installedApps: [SoftwareProduct] = []
|
|
|
|
func uninstallApps(atPaths appPaths: [String]) throws {
|
|
// Special case for testing where we pretend the trash command failed
|
|
if appPaths.contains("/dev/null") {
|
|
throw MASError.uninstallFailed(error: nil)
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Members not part of the AppLibrary protocol that are only for test state management.
|
|
extension MockAppLibrary {
|
|
/// Clears out the list of installed apps.
|
|
func reset() {
|
|
installedApps = []
|
|
}
|
|
}
|