Skip to content

Commit

Permalink
♻️ Reorder properties based on use
Browse files Browse the repository at this point in the history
  • Loading branch information
phatblat committed Mar 31, 2019
1 parent cb55711 commit c8271b4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
39 changes: 20 additions & 19 deletions MasKitTests/Models/SoftwareProductMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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
}
}
4 changes: 2 additions & 2 deletions MasKitTests/Models/SoftwareProductSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c8271b4

Please sign in to comment.