mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 19:23:01 +00:00
🧹 Lint
This commit is contained in:
parent
d39058c7be
commit
9904707152
32 changed files with 40 additions and 32 deletions
|
@ -20,11 +20,13 @@ import StoreFoundation
|
|||
func downloadAll(_ appIDs: [UInt64], purchase: Bool = false) -> Promise<Void> {
|
||||
var firstError: Error?
|
||||
return appIDs.reduce(Guarantee<Void>.value(())) { previous, appID in
|
||||
previous.then { downloadWithRetries(appID, purchase: purchase).recover { error in
|
||||
if firstError == nil {
|
||||
firstError = error
|
||||
previous.then {
|
||||
downloadWithRetries(appID, purchase: purchase).recover { error in
|
||||
if firstError == nil {
|
||||
firstError = error
|
||||
}
|
||||
}
|
||||
} }
|
||||
}
|
||||
}.done {
|
||||
if let error = firstError {
|
||||
throw error
|
||||
|
@ -42,7 +44,8 @@ private func downloadWithRetries(
|
|||
|
||||
// If the download failed due to network issues, try again. Otherwise, fail immediately.
|
||||
guard case MASError.downloadFailed(let downloadError) = error,
|
||||
case NSURLErrorDomain = downloadError?.domain else {
|
||||
case NSURLErrorDomain = downloadError?.domain
|
||||
else {
|
||||
throw error
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import Commandant
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
import enum Swift.Result
|
||||
|
||||
/// Command which displays a list of installed apps which have available updates
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import Commandant
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
import enum Swift.Result
|
||||
|
||||
/// Command which upgrades apps with new versions available in the Mac App Store.
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class AccountCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class HomeCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
let result = SearchResult(
|
||||
trackId: 1111,
|
||||
trackViewUrl: "mas preview url",
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class InfoCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
let result = SearchResult(
|
||||
currentVersionReleaseDate: "2019-01-07T18:53:13Z",
|
||||
fileSizeBytes: "1024",
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class InstallCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class ListCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class LuckyCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class OpenCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
let result = SearchResult(
|
||||
trackId: 1111,
|
||||
trackViewUrl: "fakescheme://some/url",
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class OutdatedCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class PurchaseCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class ResetCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class SearchCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
let result = SearchResult(
|
||||
trackId: 1111,
|
||||
trackName: "slack",
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class SignInCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class SignOutCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class UninstallCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class UpgradeCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class VendorCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
let result = SearchResult(
|
||||
trackId: 1111,
|
||||
trackViewUrl: "https://awesome.app",
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class VersionCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class MasAppLibrarySpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
let library = MasAppLibrary(softwareMap: SoftwareMapMock(products: apps))
|
||||
|
||||
beforeSuite {
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class MasStoreSearchSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
|
||||
import PromiseKit
|
||||
|
||||
@testable import MasKit
|
||||
|
||||
class StoreSearchMock: StoreSearch {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
import Nimble
|
||||
import PromiseKit
|
||||
import Quick
|
||||
|
||||
@testable import MasKit
|
||||
|
||||
/// Protocol minimal implementation
|
||||
|
@ -23,7 +24,7 @@ struct StoreSearchForTesting: StoreSearch {
|
|||
}
|
||||
|
||||
public class StoreSearchSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
let storeSearch = StoreSearchForTesting()
|
||||
|
||||
describe("url string") {
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class OpenSystemCommandSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class AppListsFormatterSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
// static func reference
|
||||
let format = AppListFormatter.format(products:)
|
||||
var products: [SoftwareProduct] = []
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class SearchResultsFormatterSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
// static func reference
|
||||
let format = SearchResultFormatter.format(results:includePrice:)
|
||||
var results: [SearchResult] = []
|
||||
|
|
|
@ -13,7 +13,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class SearchResultListSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class SearchResultSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import XCTest
|
|||
@testable import MasKit
|
||||
|
||||
class NetworkManagerTests: XCTestCase {
|
||||
public override func setUp() {
|
||||
override public func setUp() {
|
||||
super.setUp()
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@testable import MasKit
|
||||
|
||||
/// Mock NetworkSession for testing.
|
||||
|
|
|
@ -12,7 +12,7 @@ import Quick
|
|||
@testable import MasKit
|
||||
|
||||
public class OutputListenerSpec: QuickSpec {
|
||||
public override func spec() {
|
||||
override public func spec() {
|
||||
beforeSuite {
|
||||
MasKit.initialize()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue