mirror of
https://github.com/mas-cli/mas
synced 2025-02-16 12:38:30 +00:00
Rename Mas
as MAS
.
Partial #585 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
6bf5696093
commit
ab22e22ace
45 changed files with 74 additions and 74 deletions
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import StoreFoundation
|
import StoreFoundation
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
struct Account: ParsableCommand {
|
struct Account: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "Prints the primary account Apple ID"
|
abstract: "Prints the primary account Apple ID"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Opens app page on MAS Preview. Uses the iTunes Lookup API:
|
/// Opens app page on MAS Preview. Uses the iTunes Lookup API:
|
||||||
/// https://performance-partners.apple.com/search-api
|
/// https://performance-partners.apple.com/search-api
|
||||||
struct Home: ParsableCommand {
|
struct Home: ParsableCommand {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Displays app details. Uses the iTunes Lookup API:
|
/// Displays app details. Uses the iTunes Lookup API:
|
||||||
/// https://performance-partners.apple.com/search-api
|
/// https://performance-partners.apple.com/search-api
|
||||||
struct Info: ParsableCommand {
|
struct Info: ParsableCommand {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import CommerceKit
|
import CommerceKit
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Installs previously purchased apps from the Mac App Store.
|
/// Installs previously purchased apps from the Mac App Store.
|
||||||
struct Install: ParsableCommand {
|
struct Install: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Command which lists all installed apps.
|
/// Command which lists all installed apps.
|
||||||
struct List: ParsableCommand {
|
struct List: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import CommerceKit
|
import CommerceKit
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Command which installs the first search result.
|
/// Command which installs the first search result.
|
||||||
///
|
///
|
||||||
/// This is handy as many MAS titles can be long with embedded keywords.
|
/// This is handy as many MAS titles can be long with embedded keywords.
|
||||||
|
|
|
@ -11,7 +11,7 @@ import Foundation
|
||||||
|
|
||||||
private let masScheme = "macappstore"
|
private let masScheme = "macappstore"
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Opens app page in MAS app. Uses the iTunes Lookup API:
|
/// Opens app page in MAS app. Uses the iTunes Lookup API:
|
||||||
/// https://performance-partners.apple.com/search-api
|
/// https://performance-partners.apple.com/search-api
|
||||||
struct Open: ParsableCommand {
|
struct Open: ParsableCommand {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import ArgumentParser
|
||||||
import Foundation
|
import Foundation
|
||||||
import PromiseKit
|
import PromiseKit
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Command which displays a list of installed apps which have available updates
|
/// Command which displays a list of installed apps which have available updates
|
||||||
/// ready to be installed from the Mac App Store.
|
/// ready to be installed from the Mac App Store.
|
||||||
struct Outdated: ParsableCommand {
|
struct Outdated: ParsableCommand {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import CommerceKit
|
import CommerceKit
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
struct Purchase: ParsableCommand {
|
struct Purchase: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "Purchase and download free apps from the Mac App Store"
|
abstract: "Purchase and download free apps from the Mac App Store"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import CommerceKit
|
import CommerceKit
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Kills several macOS processes as a means to reset the app store.
|
/// Kills several macOS processes as a means to reset the app store.
|
||||||
struct Reset: ParsableCommand {
|
struct Reset: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Search the Mac App Store using the iTunes Search API.
|
/// Search the Mac App Store using the iTunes Search API.
|
||||||
///
|
///
|
||||||
/// See - https://performance-partners.apple.com/search-api
|
/// See - https://performance-partners.apple.com/search-api
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import StoreFoundation
|
import StoreFoundation
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
struct SignIn: ParsableCommand {
|
struct SignIn: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
commandName: "signin",
|
commandName: "signin",
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import CommerceKit
|
import CommerceKit
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
struct SignOut: ParsableCommand {
|
struct SignOut: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
commandName: "signout",
|
commandName: "signout",
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Command which uninstalls apps managed by the Mac App Store.
|
/// Command which uninstalls apps managed by the Mac App Store.
|
||||||
struct Uninstall: ParsableCommand {
|
struct Uninstall: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
|
|
|
@ -10,7 +10,7 @@ import ArgumentParser
|
||||||
import Foundation
|
import Foundation
|
||||||
import PromiseKit
|
import PromiseKit
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Command which upgrades apps with new versions available in the Mac App Store.
|
/// Command which upgrades apps with new versions available in the Mac App Store.
|
||||||
struct Upgrade: ParsableCommand {
|
struct Upgrade: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Opens vendor's app page in a browser. Uses the iTunes Lookup API:
|
/// Opens vendor's app page in a browser. Uses the iTunes Lookup API:
|
||||||
/// https://performance-partners.apple.com/search-api
|
/// https://performance-partners.apple.com/search-api
|
||||||
struct Vendor: ParsableCommand {
|
struct Vendor: ParsableCommand {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
|
||||||
extension Mas {
|
extension MAS {
|
||||||
/// Command which displays the version of the mas tool.
|
/// Command which displays the version of the mas tool.
|
||||||
struct Version: ParsableCommand {
|
struct Version: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Mas.swift
|
// MAS.swift
|
||||||
// mas
|
// mas
|
||||||
//
|
//
|
||||||
// Created by Chris Araman on 4/22/21.
|
// Created by Chris Araman on 4/22/21.
|
||||||
|
@ -11,7 +11,7 @@ import Foundation
|
||||||
import PromiseKit
|
import PromiseKit
|
||||||
|
|
||||||
@main
|
@main
|
||||||
struct Mas: ParsableCommand {
|
struct MAS: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
abstract: "Mac App Store command-line interface",
|
abstract: "Mac App Store command-line interface",
|
||||||
subcommands: [
|
subcommands: [
|
|
@ -15,13 +15,13 @@ import Quick
|
||||||
public class AccountSpec: QuickSpec {
|
public class AccountSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
// account command disabled since macOS 12 Monterey https://github.com/mas-cli/mas#known-issues
|
// account command disabled since macOS 12 Monterey https://github.com/mas-cli/mas#known-issues
|
||||||
describe("Account command") {
|
describe("Account command") {
|
||||||
it("displays active account") {
|
it("displays active account") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Account.parse([]).run()
|
try MAS.Account.parse([]).run()
|
||||||
}
|
}
|
||||||
.to(throwError(MASError.notSupported))
|
.to(throwError(MASError.notSupported))
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class HomeSpec: QuickSpec {
|
||||||
let openCommand = OpenSystemCommandMock()
|
let openCommand = OpenSystemCommandMock()
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("home command") {
|
describe("home command") {
|
||||||
beforeEach {
|
beforeEach {
|
||||||
|
@ -25,13 +25,13 @@ public class HomeSpec: QuickSpec {
|
||||||
}
|
}
|
||||||
it("fails to open app with invalid ID") {
|
it("fails to open app with invalid ID") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Home.parse(["--", "-999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
try MAS.Home.parse(["--", "-999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
}
|
}
|
||||||
.to(throwError())
|
.to(throwError())
|
||||||
}
|
}
|
||||||
it("can't find app with unknown ID") {
|
it("can't find app with unknown ID") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Home.parse(["999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
try MAS.Home.parse(["999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
}
|
}
|
||||||
.to(throwError(MASError.noSearchResultsFound))
|
.to(throwError(MASError.noSearchResultsFound))
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class HomeSpec: QuickSpec {
|
||||||
)
|
)
|
||||||
storeSearch.apps[mockResult.trackId] = mockResult
|
storeSearch.apps[mockResult.trackId] = mockResult
|
||||||
expect {
|
expect {
|
||||||
try Mas.Home.parse([String(mockResult.trackId)])
|
try MAS.Home.parse([String(mockResult.trackId)])
|
||||||
.run(storeSearch: storeSearch, openCommand: openCommand)
|
.run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
return openCommand.arguments
|
return openCommand.arguments
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class InfoSpec: QuickSpec {
|
||||||
let storeSearch = StoreSearchMock()
|
let storeSearch = StoreSearchMock()
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("Info command") {
|
describe("Info command") {
|
||||||
beforeEach {
|
beforeEach {
|
||||||
|
@ -25,13 +25,13 @@ public class InfoSpec: QuickSpec {
|
||||||
}
|
}
|
||||||
it("fails to open app with invalid ID") {
|
it("fails to open app with invalid ID") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Info.parse(["--", "-999"]).run(storeSearch: storeSearch)
|
try MAS.Info.parse(["--", "-999"]).run(storeSearch: storeSearch)
|
||||||
}
|
}
|
||||||
.to(throwError())
|
.to(throwError())
|
||||||
}
|
}
|
||||||
it("can't find app with unknown ID") {
|
it("can't find app with unknown ID") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Info.parse(["999"]).run(storeSearch: storeSearch)
|
try MAS.Info.parse(["999"]).run(storeSearch: storeSearch)
|
||||||
}
|
}
|
||||||
.to(throwError(MASError.noSearchResultsFound))
|
.to(throwError(MASError.noSearchResultsFound))
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class InfoSpec: QuickSpec {
|
||||||
storeSearch.apps[mockResult.trackId] = mockResult
|
storeSearch.apps[mockResult.trackId] = mockResult
|
||||||
expect {
|
expect {
|
||||||
try captureStream(stdout) {
|
try captureStream(stdout) {
|
||||||
try Mas.Info.parse([String(mockResult.trackId)]).run(storeSearch: storeSearch)
|
try MAS.Info.parse([String(mockResult.trackId)]).run(storeSearch: storeSearch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
== """
|
== """
|
||||||
|
|
|
@ -14,12 +14,12 @@ import Quick
|
||||||
public class InstallSpec: QuickSpec {
|
public class InstallSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
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: AppLibraryMock())
|
||||||
}
|
}
|
||||||
.toNot(throwError())
|
.toNot(throwError())
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,13 @@ import Quick
|
||||||
public class ListSpec: QuickSpec {
|
public class ListSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("list command") {
|
describe("list command") {
|
||||||
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: AppLibraryMock())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
== "Error: No installed apps found\n"
|
== "Error: No installed apps found\n"
|
||||||
|
|
|
@ -17,12 +17,12 @@ public class LuckySpec: QuickSpec {
|
||||||
let storeSearch = MasStoreSearch(networkManager: NetworkManager(session: networkSession))
|
let storeSearch = MasStoreSearch(networkManager: NetworkManager(session: networkSession))
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
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(), storeSearch: storeSearch)
|
try MAS.Lucky.parse(["Slack"]).run(appLibrary: AppLibraryMock(), storeSearch: storeSearch)
|
||||||
}
|
}
|
||||||
.toNot(throwError())
|
.toNot(throwError())
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class OpenSpec: QuickSpec {
|
||||||
let openCommand = OpenSystemCommandMock()
|
let openCommand = OpenSystemCommandMock()
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("open command") {
|
describe("open command") {
|
||||||
beforeEach {
|
beforeEach {
|
||||||
|
@ -26,13 +26,13 @@ public class OpenSpec: QuickSpec {
|
||||||
}
|
}
|
||||||
it("fails to open app with invalid ID") {
|
it("fails to open app with invalid ID") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Open.parse(["--", "-999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
try MAS.Open.parse(["--", "-999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
}
|
}
|
||||||
.to(throwError())
|
.to(throwError())
|
||||||
}
|
}
|
||||||
it("can't find app with unknown ID") {
|
it("can't find app with unknown ID") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Open.parse(["999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
try MAS.Open.parse(["999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
}
|
}
|
||||||
.to(throwError(MASError.noSearchResultsFound))
|
.to(throwError(MASError.noSearchResultsFound))
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class OpenSpec: QuickSpec {
|
||||||
)
|
)
|
||||||
storeSearch.apps[mockResult.trackId] = mockResult
|
storeSearch.apps[mockResult.trackId] = mockResult
|
||||||
expect {
|
expect {
|
||||||
try Mas.Open.parse([mockResult.trackId.description])
|
try MAS.Open.parse([mockResult.trackId.description])
|
||||||
.run(storeSearch: storeSearch, openCommand: openCommand)
|
.run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
return openCommand.arguments
|
return openCommand.arguments
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class OpenSpec: QuickSpec {
|
||||||
}
|
}
|
||||||
it("just opens MAS if no app specified") {
|
it("just opens MAS if no app specified") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Open.parse([]).run(storeSearch: storeSearch, openCommand: openCommand)
|
try MAS.Open.parse([]).run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
return openCommand.arguments
|
return openCommand.arguments
|
||||||
}
|
}
|
||||||
== ["macappstore://"]
|
== ["macappstore://"]
|
||||||
|
|
|
@ -15,7 +15,7 @@ import Quick
|
||||||
public class OutdatedSpec: QuickSpec {
|
public class OutdatedSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("outdated command") {
|
describe("outdated command") {
|
||||||
it("displays apps with pending updates") {
|
it("displays apps with pending updates") {
|
||||||
|
@ -48,7 +48,7 @@ public class OutdatedSpec: QuickSpec {
|
||||||
)
|
)
|
||||||
expect {
|
expect {
|
||||||
try captureStream(stdout) {
|
try captureStream(stdout) {
|
||||||
try Mas.Outdated.parse([]).run(appLibrary: mockAppLibrary, storeSearch: mockStoreSearch)
|
try MAS.Outdated.parse([]).run(appLibrary: mockAppLibrary, storeSearch: mockStoreSearch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
== "490461369 Bandwidth+ (1.27 -> 1.28)\n"
|
== "490461369 Bandwidth+ (1.27 -> 1.28)\n"
|
||||||
|
|
|
@ -14,12 +14,12 @@ import Quick
|
||||||
public class PurchaseSpec: QuickSpec {
|
public class PurchaseSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
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: AppLibraryMock())
|
||||||
}
|
}
|
||||||
.toNot(throwError())
|
.toNot(throwError())
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ import Quick
|
||||||
public class ResetSpec: QuickSpec {
|
public class ResetSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("reset command") {
|
describe("reset command") {
|
||||||
it("resets the App Store state") {
|
it("resets the App Store state") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Reset.parse([]).run()
|
try MAS.Reset.parse([]).run()
|
||||||
}
|
}
|
||||||
.toNot(throwError())
|
.toNot(throwError())
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class SearchSpec: QuickSpec {
|
||||||
let storeSearch = StoreSearchMock()
|
let storeSearch = StoreSearchMock()
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("search command") {
|
describe("search command") {
|
||||||
beforeEach {
|
beforeEach {
|
||||||
|
@ -33,14 +33,14 @@ public class SearchSpec: QuickSpec {
|
||||||
storeSearch.apps[mockResult.trackId] = mockResult
|
storeSearch.apps[mockResult.trackId] = mockResult
|
||||||
expect {
|
expect {
|
||||||
try captureStream(stdout) {
|
try captureStream(stdout) {
|
||||||
try Mas.Search.parse(["slack"]).run(storeSearch: storeSearch)
|
try MAS.Search.parse(["slack"]).run(storeSearch: storeSearch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
== " 1111 slack (0.0)\n"
|
== " 1111 slack (0.0)\n"
|
||||||
}
|
}
|
||||||
it("fails when searching for nonexistent app") {
|
it("fails when searching for nonexistent app") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Search.parse(["nonexistent"]).run(storeSearch: storeSearch)
|
try MAS.Search.parse(["nonexistent"]).run(storeSearch: storeSearch)
|
||||||
}
|
}
|
||||||
.to(throwError(MASError.noSearchResultsFound))
|
.to(throwError(MASError.noSearchResultsFound))
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,13 @@ import Quick
|
||||||
public class SignInSpec: QuickSpec {
|
public class SignInSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
// account command disabled since macOS 10.13 High Sierra https://github.com/mas-cli/mas#known-issues
|
// account command disabled since macOS 10.13 High Sierra https://github.com/mas-cli/mas#known-issues
|
||||||
describe("signin command") {
|
describe("signin command") {
|
||||||
it("signs in") {
|
it("signs in") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.SignIn.parse(["", ""]).run()
|
try MAS.SignIn.parse(["", ""]).run()
|
||||||
}
|
}
|
||||||
.to(throwError(MASError.notSupported))
|
.to(throwError(MASError.notSupported))
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ import Quick
|
||||||
public class SignOutSpec: QuickSpec {
|
public class SignOutSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("signout command") {
|
describe("signout command") {
|
||||||
it("signs out") {
|
it("signs out") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.SignOut.parse([]).run()
|
try MAS.SignOut.parse([]).run()
|
||||||
}
|
}
|
||||||
.toNot(throwError())
|
.toNot(throwError())
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import Quick
|
||||||
public class UninstallSpec: QuickSpec {
|
public class UninstallSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
xdescribe("uninstall command") {
|
xdescribe("uninstall command") {
|
||||||
let appID: AppID = 12345
|
let appID: AppID = 12345
|
||||||
|
@ -29,7 +29,7 @@ public class UninstallSpec: QuickSpec {
|
||||||
let mockLibrary = AppLibraryMock()
|
let mockLibrary = AppLibraryMock()
|
||||||
|
|
||||||
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)])
|
||||||
|
|
||||||
beforeEach {
|
beforeEach {
|
||||||
mockLibrary.reset()
|
mockLibrary.reset()
|
||||||
|
@ -51,7 +51,7 @@ public class UninstallSpec: QuickSpec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context("wet run") {
|
context("wet run") {
|
||||||
let uninstall = try! Mas.Uninstall.parse([String(appID)])
|
let uninstall = try! MAS.Uninstall.parse([String(appID)])
|
||||||
|
|
||||||
beforeEach {
|
beforeEach {
|
||||||
mockLibrary.reset()
|
mockLibrary.reset()
|
||||||
|
|
|
@ -15,13 +15,13 @@ import Quick
|
||||||
public class UpgradeSpec: QuickSpec {
|
public class UpgradeSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("upgrade command") {
|
describe("upgrade command") {
|
||||||
it("finds no upgrades") {
|
it("finds no upgrades") {
|
||||||
expect {
|
expect {
|
||||||
try captureStream(stderr) {
|
try captureStream(stderr) {
|
||||||
try Mas.Upgrade.parse([])
|
try MAS.Upgrade.parse([])
|
||||||
.run(appLibrary: AppLibraryMock(), storeSearch: StoreSearchMock())
|
.run(appLibrary: AppLibraryMock(), storeSearch: StoreSearchMock())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class VendorSpec: QuickSpec {
|
||||||
let openCommand = OpenSystemCommandMock()
|
let openCommand = OpenSystemCommandMock()
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("vendor command") {
|
describe("vendor command") {
|
||||||
beforeEach {
|
beforeEach {
|
||||||
|
@ -25,13 +25,13 @@ public class VendorSpec: QuickSpec {
|
||||||
}
|
}
|
||||||
it("fails to open app with invalid ID") {
|
it("fails to open app with invalid ID") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Vendor.parse(["--", "-999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
try MAS.Vendor.parse(["--", "-999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
}
|
}
|
||||||
.to(throwError())
|
.to(throwError())
|
||||||
}
|
}
|
||||||
it("can't find app with unknown ID") {
|
it("can't find app with unknown ID") {
|
||||||
expect {
|
expect {
|
||||||
try Mas.Vendor.parse(["999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
try MAS.Vendor.parse(["999"]).run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
}
|
}
|
||||||
.to(throwError(MASError.noSearchResultsFound))
|
.to(throwError(MASError.noSearchResultsFound))
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class VendorSpec: QuickSpec {
|
||||||
)
|
)
|
||||||
storeSearch.apps[mockResult.trackId] = mockResult
|
storeSearch.apps[mockResult.trackId] = mockResult
|
||||||
expect {
|
expect {
|
||||||
try Mas.Vendor.parse([String(mockResult.trackId)])
|
try MAS.Vendor.parse([String(mockResult.trackId)])
|
||||||
.run(storeSearch: storeSearch, openCommand: openCommand)
|
.run(storeSearch: storeSearch, openCommand: openCommand)
|
||||||
return openCommand.arguments
|
return openCommand.arguments
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,13 @@ import Quick
|
||||||
public class VersionSpec: QuickSpec {
|
public class VersionSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("version command") {
|
describe("version command") {
|
||||||
it("displays the current version") {
|
it("displays the current version") {
|
||||||
expect {
|
expect {
|
||||||
try captureStream(stdout) {
|
try captureStream(stdout) {
|
||||||
try Mas.Version.parse([]).run()
|
try MAS.Version.parse([]).run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
== "\(Package.version)\n"
|
== "\(Package.version)\n"
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class MasAppLibrarySpec: QuickSpec {
|
||||||
let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps))
|
let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps))
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("mas app library") {
|
describe("mas app library") {
|
||||||
it("contains all installed apps") {
|
it("contains all installed apps") {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import Quick
|
||||||
public class MasStoreSearchSpec: QuickSpec {
|
public class MasStoreSearchSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("url string") {
|
describe("url string") {
|
||||||
it("contains the app name") {
|
it("contains the app name") {
|
||||||
|
|
|
@ -32,7 +32,7 @@ class MASErrorTestCase: XCTestCase {
|
||||||
|
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
nserror = NSError(domain: errorDomain, code: 999)
|
nserror = NSError(domain: errorDomain, code: 999)
|
||||||
localizedDescription = "foo"
|
localizedDescription = "foo"
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import Quick
|
||||||
public class OpenSystemCommandSpec: QuickSpec {
|
public class OpenSystemCommandSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("open system command") {
|
describe("open system command") {
|
||||||
context("binary path") {
|
context("binary path") {
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class AppListFormatterSpec: QuickSpec {
|
||||||
var products: [SoftwareProduct] = []
|
var products: [SoftwareProduct] = []
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("app list formatter") {
|
describe("app list formatter") {
|
||||||
beforeEach {
|
beforeEach {
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class SearchResultFormatterSpec: QuickSpec {
|
||||||
var results: [SearchResult] = []
|
var results: [SearchResult] = []
|
||||||
|
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("search results formatter") {
|
describe("search results formatter") {
|
||||||
beforeEach {
|
beforeEach {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import Quick
|
||||||
public class SearchResultListSpec: QuickSpec {
|
public class SearchResultListSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("search result list") {
|
describe("search result list") {
|
||||||
it("can parse bbedit") {
|
it("can parse bbedit") {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import Quick
|
||||||
public class SearchResultSpec: QuickSpec {
|
public class SearchResultSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("search result") {
|
describe("search result") {
|
||||||
it("can parse things") {
|
it("can parse things") {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import Quick
|
||||||
public class SoftwareProductSpec: QuickSpec {
|
public class SoftwareProductSpec: QuickSpec {
|
||||||
override public func spec() {
|
override public func spec() {
|
||||||
beforeSuite {
|
beforeSuite {
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
describe("software product") {
|
describe("software product") {
|
||||||
let app = SoftwareProductMock(
|
let app = SoftwareProductMock(
|
||||||
|
|
|
@ -13,7 +13,7 @@ import XCTest
|
||||||
class NetworkManagerTests: XCTestCase {
|
class NetworkManagerTests: XCTestCase {
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
Mas.initialize()
|
MAS.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSuccessfulAsyncResponse() throws {
|
func testSuccessfulAsyncResponse() throws {
|
||||||
|
|
Loading…
Add table
Reference in a new issue