From c8271b4a7e02775e22865e8022b7d85b7df62585 Mon Sep 17 00:00:00 2001 From: Ben Chatelain Date: Sat, 30 Mar 2019 16:24:01 -0600 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Reorder=20properties=20bas?= =?UTF-8?q?ed=20on=20use?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MasKitTests/Models/SoftwareProductMock.swift | 39 ++++++++++---------- MasKitTests/Models/SoftwareProductSpec.swift | 4 +- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/MasKitTests/Models/SoftwareProductMock.swift b/MasKitTests/Models/SoftwareProductMock.swift index dc3bfb750..11f7b0bfc 100644 --- a/MasKitTests/Models/SoftwareProductMock.swift +++ b/MasKitTests/Models/SoftwareProductMock.swift @@ -9,9 +9,15 @@ @testable import MasKit struct SoftwareProductMock: SoftwareProduct { + var appName: String + var bundleIdentifier: String + var bundlePath: String + var bundleVersion: String + var itemIdentifier: NSNumber + + // Fields not currently in use var accountIdentifier: String var accountOpaqueDSID: String - var bundleIdentifier: String var description: String var expectedBundleVersion: String? var expectedStoreVersion: NSNumber? @@ -22,15 +28,15 @@ struct SoftwareProductMock: SoftwareProduct { var purchaseDate: Date? var storeFrontIdentifier: NSNumber? - var appName: String - var bundlePath: String - var bundleVersion: String - var itemIdentifier: NSNumber - init( + appName: String = "", + bundleIdentifier: String = "", + bundlePath: String = "", + bundleVersion: String = "", + itemIdentifier: NSNumber = 0, + accountIdentifier: String = "", accountOpaqueDSID: String = "", - bundleIdentifier: String = "", description: String = "", expectedBundleVersion: String? = nil, expectedStoreVersion: NSNumber? = nil, @@ -39,16 +45,16 @@ struct SoftwareProductMock: SoftwareProduct { isLegacyApp: Bool = false, isMachineLicensed: Bool = false, purchaseDate: Date = Date(), - storeFrontIdentifier: NSNumber = 0, - - appName: String = "", - bundlePath: String = "", - bundleVersion: String = "", - itemIdentifier: NSNumber = 0 + storeFrontIdentifier: NSNumber = 0 ) { + self.appName = appName + self.bundleIdentifier = bundleIdentifier + self.bundlePath = bundlePath + self.bundleVersion = bundleVersion + self.itemIdentifier = itemIdentifier + self.accountIdentifier = accountIdentifier self.accountOpaqueDSID = accountOpaqueDSID - self.bundleIdentifier = bundleIdentifier self.description = description self.expectedBundleVersion = expectedBundleVersion self.expectedStoreVersion = expectedStoreVersion @@ -58,10 +64,5 @@ struct SoftwareProductMock: SoftwareProduct { self.isMachineLicensed = isMachineLicensed self.purchaseDate = purchaseDate self.storeFrontIdentifier = storeFrontIdentifier - - self.appName = appName - self.bundlePath = bundlePath - self.bundleVersion = bundleVersion - self.itemIdentifier = itemIdentifier } } diff --git a/MasKitTests/Models/SoftwareProductSpec.swift b/MasKitTests/Models/SoftwareProductSpec.swift index 77f138e96..729982d13 100644 --- a/MasKitTests/Models/SoftwareProductSpec.swift +++ b/MasKitTests/Models/SoftwareProductSpec.swift @@ -16,8 +16,8 @@ class SoftwareProductSpec: QuickSpec { describe("software product") { it("can be a macos installer") { let product = SoftwareProductMock( - bundleIdentifier: "com.apple.InstallAssistant.Mojave", - appName: "Install macOS Mojave" + appName: "Install macOS Mojave", + bundleIdentifier: "com.apple.InstallAssistant.Mojave" ) expect(product.isMacosInstaller) == true }