2
0
Fork 0
mirror of https://github.com/mas-cli/mas synced 2025-03-06 23:57:21 +00:00

Move test variable declarations & assignments to proper places.

Partial 

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
Ross Goldberg 2024-12-31 19:29:06 -05:00
parent ad3898a404
commit 6a37882311
No known key found for this signature in database
2 changed files with 21 additions and 26 deletions

View file

@ -14,19 +14,19 @@ import Quick
public final class UninstallSpec: QuickSpec {
override public func spec() {
let appID: AppID = 12345
let app = MockSoftwareProduct(
appName: "Some App",
bundleIdentifier: "com.some.app",
bundlePath: "/tmp/Some.app",
bundleVersion: "1.0",
itemIdentifier: NSNumber(value: appID)
)
beforeSuite {
MAS.initialize()
}
xdescribe("uninstall command") {
let appID: AppID = 12345
let app = MockSoftwareProduct(
appName: "Some App",
bundleIdentifier: "com.some.app",
bundlePath: "/tmp/Some.app",
bundleVersion: "1.0",
itemIdentifier: NSNumber(value: appID)
)
context("dry run") {
let uninstall = try! MAS.Uninstall.parse(["--dry-run", String(appID)])

View file

@ -14,34 +14,29 @@ import Quick
public final class SoftwareProductSpec: QuickSpec {
override public func spec() {
let app = MockSoftwareProduct(
appName: "App",
bundleIdentifier: "",
bundlePath: "",
bundleVersion: "1.0.0",
itemIdentifier: 111
)
beforeSuite {
MAS.initialize()
}
describe("software product") {
let app = MockSoftwareProduct(
appName: "App",
bundleIdentifier: "",
bundlePath: "",
bundleVersion: "1.0.0",
itemIdentifier: 111
)
let currentApp = SearchResult(version: "1.0.0")
let appUpdate = SearchResult(version: "2.0.0")
let higherOs = SearchResult(minimumOsVersion: "99.0.0", version: "3.0.0")
let updateIos = SearchResult(minimumOsVersion: "99.0.0", version: "3.0.0")
it("is not outdated when there is no new version available") {
expect(app.isOutdated(comparedTo: currentApp)) == false
expect(app.isOutdated(comparedTo: SearchResult(version: "1.0.0"))) == false
}
it("is outdated when there is a new version available") {
expect(app.isOutdated(comparedTo: appUpdate)) == true
expect(app.isOutdated(comparedTo: SearchResult(version: "2.0.0"))) == true
}
it("is not outdated when the new version of mac-software requires a higher OS version") {
expect(app.isOutdated(comparedTo: higherOs)) == false
expect(app.isOutdated(comparedTo: SearchResult(minimumOsVersion: "99.0.0", version: "3.0.0"))) == false
}
it("is not outdated when the new version of software requires a higher OS version") {
expect(app.isOutdated(comparedTo: updateIos)) == false
expect(app.isOutdated(comparedTo: SearchResult(minimumOsVersion: "99.0.0", version: "3.0.0"))) == false
}
}
}