2021-10-01 02:55:36 +00:00
|
|
|
//
|
|
|
|
// SoftwareProductSpec.swift
|
2024-10-01 18:05:41 +00:00
|
|
|
// masTests
|
2021-10-01 02:55:36 +00:00
|
|
|
//
|
|
|
|
// Created by Ben Chatelain on 9/30/21.
|
|
|
|
// Copyright © 2018 mas-cli. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import Nimble
|
|
|
|
import Quick
|
|
|
|
|
2024-10-01 18:05:41 +00:00
|
|
|
@testable import mas
|
2021-10-01 02:55:36 +00:00
|
|
|
|
|
|
|
public class SoftwareProductSpec: QuickSpec {
|
2024-10-18 14:28:44 +00:00
|
|
|
override public func spec() {
|
2021-10-01 02:55:36 +00:00
|
|
|
beforeSuite {
|
2024-10-25 17:21:19 +00:00
|
|
|
MAS.initialize()
|
2021-10-01 02:55:36 +00:00
|
|
|
}
|
|
|
|
describe("software product") {
|
2024-10-26 03:09:31 +00:00
|
|
|
let app = MockSoftwareProduct(
|
2021-11-02 04:11:16 +00:00
|
|
|
appName: "App",
|
|
|
|
bundleIdentifier: "",
|
|
|
|
bundlePath: "",
|
|
|
|
bundleVersion: "1.0.0",
|
|
|
|
itemIdentifier: 111
|
|
|
|
)
|
2021-10-01 02:55:36 +00:00
|
|
|
|
2024-09-16 15:16:28 +00:00
|
|
|
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")
|
2021-10-01 02:55:36 +00:00
|
|
|
|
2021-10-13 01:52:37 +00:00
|
|
|
it("is not outdated when there is no new version available") {
|
2021-10-01 02:55:36 +00:00
|
|
|
expect(app.isOutdatedWhenComparedTo(currentApp)) == false
|
|
|
|
}
|
|
|
|
it("is outdated when there is a new version available") {
|
|
|
|
expect(app.isOutdatedWhenComparedTo(appUpdate)) == true
|
|
|
|
}
|
2024-09-16 15:16:28 +00:00
|
|
|
it("is not outdated when the new version of mac-software requires a higher OS version") {
|
2021-10-01 02:55:36 +00:00
|
|
|
expect(app.isOutdatedWhenComparedTo(higherOs)) == false
|
|
|
|
}
|
2024-09-16 15:16:28 +00:00
|
|
|
it("is not outdated when the new version of software requires a higher OS version") {
|
|
|
|
expect(app.isOutdatedWhenComparedTo(updateIos)) == false
|
2021-10-01 03:43:18 +00:00
|
|
|
}
|
2021-10-01 02:55:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|