Rename MasAppLibrary as SoftwareMapAppLibrary.

Rename `AppLibraryMock` as `MockAppLibrary`.

Partial #585

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
Ross Goldberg 2024-10-25 20:48:03 -04:00
parent d7072fc66d
commit cc219fe644
No known key found for this signature in database
17 changed files with 22 additions and 22 deletions

View file

@ -23,7 +23,7 @@ extension MAS {
/// Runs the command. /// Runs the command.
func run() throws { func run() throws {
try run(appLibrary: MasAppLibrary()) try run(appLibrary: SoftwareMapAppLibrary())
} }
func run(appLibrary: AppLibrary) throws { func run(appLibrary: AppLibrary) throws {

View file

@ -17,7 +17,7 @@ extension MAS {
/// Runs the command. /// Runs the command.
func run() throws { func run() throws {
try run(appLibrary: MasAppLibrary()) try run(appLibrary: SoftwareMapAppLibrary())
} }
func run(appLibrary: AppLibrary) throws { func run(appLibrary: AppLibrary) throws {

View file

@ -25,7 +25,7 @@ extension MAS {
/// Runs the command. /// Runs the command.
func run() throws { func run() throws {
try run(appLibrary: MasAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) try run(appLibrary: SoftwareMapAppLibrary(), searcher: ITunesSearchAppStoreSearcher())
} }
func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws { func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws {

View file

@ -23,7 +23,7 @@ extension MAS {
/// Runs the command. /// Runs the command.
func run() throws { func run() throws {
try run(appLibrary: MasAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) try run(appLibrary: SoftwareMapAppLibrary(), searcher: ITunesSearchAppStoreSearcher())
} }
func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws { func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws {

View file

@ -20,7 +20,7 @@ extension MAS {
/// Runs the command. /// Runs the command.
func run() throws { func run() throws {
try run(appLibrary: MasAppLibrary()) try run(appLibrary: SoftwareMapAppLibrary())
} }
func run(appLibrary: AppLibrary) throws { func run(appLibrary: AppLibrary) throws {

View file

@ -24,7 +24,7 @@ extension MAS {
/// Runs the uninstall command. /// Runs the uninstall command.
func run() throws { func run() throws {
try run(appLibrary: MasAppLibrary()) try run(appLibrary: SoftwareMapAppLibrary())
} }
func run(appLibrary: AppLibrary) throws { func run(appLibrary: AppLibrary) throws {

View file

@ -22,7 +22,7 @@ extension MAS {
/// Runs the command. /// Runs the command.
func run() throws { func run() throws {
try run(appLibrary: MasAppLibrary(), searcher: ITunesSearchAppStoreSearcher()) try run(appLibrary: SoftwareMapAppLibrary(), searcher: ITunesSearchAppStoreSearcher())
} }
func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws { func run(appLibrary: AppLibrary, searcher: AppStoreSearcher) throws {

View file

@ -1,5 +1,5 @@
// //
// MasAppLibrary.swift // SoftwareMapAppLibrary.swift
// mas // mas
// //
// Created by Ben Chatelain on 12/27/18. // Created by Ben Chatelain on 12/27/18.
@ -10,7 +10,7 @@ import CommerceKit
import ScriptingBridge import ScriptingBridge
/// Utility for managing installed apps. /// Utility for managing installed apps.
class MasAppLibrary: AppLibrary { class SoftwareMapAppLibrary: AppLibrary {
/// CommerceKit's singleton manager of installed software. /// CommerceKit's singleton manager of installed software.
private let softwareMap: SoftwareMap private let softwareMap: SoftwareMap

View file

@ -19,7 +19,7 @@ public class InstallSpec: QuickSpec {
xdescribe("install command") { xdescribe("install command") {
xit("installs apps") { xit("installs apps") {
expect { expect {
try MAS.Install.parse([]).run(appLibrary: AppLibraryMock()) try MAS.Install.parse([]).run(appLibrary: MockAppLibrary())
} }
.toNot(throwError()) .toNot(throwError())
} }

View file

@ -21,7 +21,7 @@ public class ListSpec: QuickSpec {
it("lists apps") { it("lists apps") {
expect { expect {
try captureStream(stderr) { try captureStream(stderr) {
try MAS.List.parse([]).run(appLibrary: AppLibraryMock()) try MAS.List.parse([]).run(appLibrary: MockAppLibrary())
} }
} }
== "Error: No installed apps found\n" == "Error: No installed apps found\n"

View file

@ -22,7 +22,7 @@ public class LuckySpec: QuickSpec {
xdescribe("lucky command") { xdescribe("lucky command") {
xit("installs the first app matching a search") { xit("installs the first app matching a search") {
expect { expect {
try MAS.Lucky.parse(["Slack"]).run(appLibrary: AppLibraryMock(), searcher: searcher) try MAS.Lucky.parse(["Slack"]).run(appLibrary: MockAppLibrary(), searcher: searcher)
} }
.toNot(throwError()) .toNot(throwError())
} }

View file

@ -36,7 +36,7 @@ public class OutdatedSpec: QuickSpec {
let searcher = MockAppStoreSearcher() let searcher = MockAppStoreSearcher()
searcher.apps[mockSearchResult.trackId] = mockSearchResult searcher.apps[mockSearchResult.trackId] = mockSearchResult
let mockAppLibrary = AppLibraryMock() let mockAppLibrary = MockAppLibrary()
mockAppLibrary.installedApps.append( mockAppLibrary.installedApps.append(
SoftwareProductMock( SoftwareProductMock(
appName: mockSearchResult.trackName, appName: mockSearchResult.trackName,

View file

@ -19,7 +19,7 @@ public class PurchaseSpec: QuickSpec {
xdescribe("purchase command") { xdescribe("purchase command") {
xit("purchases apps") { xit("purchases apps") {
expect { expect {
try MAS.Purchase.parse(["999"]).run(appLibrary: AppLibraryMock()) try MAS.Purchase.parse(["999"]).run(appLibrary: MockAppLibrary())
} }
.toNot(throwError()) .toNot(throwError())
} }

View file

@ -26,7 +26,7 @@ public class UninstallSpec: QuickSpec {
bundleVersion: "1.0", bundleVersion: "1.0",
itemIdentifier: NSNumber(value: appID) itemIdentifier: NSNumber(value: appID)
) )
let mockLibrary = AppLibraryMock() let mockLibrary = MockAppLibrary()
context("dry run") { context("dry run") {
let uninstall = try! MAS.Uninstall.parse(["--dry-run", String(appID)]) let uninstall = try! MAS.Uninstall.parse(["--dry-run", String(appID)])

View file

@ -22,7 +22,7 @@ public class UpgradeSpec: QuickSpec {
expect { expect {
try captureStream(stderr) { try captureStream(stderr) {
try MAS.Upgrade.parse([]) try MAS.Upgrade.parse([])
.run(appLibrary: AppLibraryMock(), searcher: MockAppStoreSearcher()) .run(appLibrary: MockAppLibrary(), searcher: MockAppStoreSearcher())
} }
} }
== "Warning: Nothing found to upgrade\n" == "Warning: Nothing found to upgrade\n"

View file

@ -1,5 +1,5 @@
// //
// AppLibraryMock.swift // MockAppLibrary.swift
// masTests // masTests
// //
// Created by Ben Chatelain on 12/27/18. // Created by Ben Chatelain on 12/27/18.
@ -8,7 +8,7 @@
@testable import mas @testable import mas
class AppLibraryMock: AppLibrary { class MockAppLibrary: AppLibrary {
var installedApps: [SoftwareProduct] = [] var installedApps: [SoftwareProduct] = []
func uninstallApps(atPaths appPaths: [String]) throws { func uninstallApps(atPaths appPaths: [String]) throws {
@ -20,7 +20,7 @@ class AppLibraryMock: AppLibrary {
} }
/// Members not part of the AppLibrary protocol that are only for test state management. /// Members not part of the AppLibrary protocol that are only for test state management.
extension AppLibraryMock { extension MockAppLibrary {
/// Clears out the list of installed apps. /// Clears out the list of installed apps.
func reset() { func reset() {
installedApps = [] installedApps = []

View file

@ -1,5 +1,5 @@
// //
// MasAppLibrarySpec.swift // SoftwareMapAppLibrarySpec.swift
// masTests // masTests
// //
// Created by Ben Chatelain on 3/1/20. // Created by Ben Chatelain on 3/1/20.
@ -11,9 +11,9 @@ import Quick
@testable import mas @testable import mas
public class MasAppLibrarySpec: QuickSpec { public class SoftwareMapAppLibrarySpec: QuickSpec {
override public func spec() { override public func spec() {
let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps)) let library = SoftwareMapAppLibrary(softwareMap: SoftwareMapMock(products: apps))
beforeSuite { beforeSuite {
MAS.initialize() MAS.initialize()