- Add AtlasUpdateChecker with GitHub Releases API integration - Add AtlasVersionComparator for semantic version comparison - Add AboutUpdateToolbarButton with popover update UI - Enhance AboutFeatureView with social QR codes and layout refinements - Add CHANGELOG.md and CODE_OF_CONDUCT.md - Rebrand project files from Mole to Atlas for Mac - Update build script to support version/build number injection - Add installation guide to README - Add bilingual localization strings for update feature - Add unit tests for update checker and version comparator
81 lines
1.8 KiB
Swift
81 lines
1.8 KiB
Swift
import XCTest
|
|
@testable import AtlasDomain
|
|
|
|
final class AtlasVersionComparatorTests: XCTestCase {
|
|
|
|
func testEqualVersions() {
|
|
XCTAssertEqual(
|
|
AtlasVersionComparator.compare("1.0.0", "1.0.0"),
|
|
.orderedSame
|
|
)
|
|
}
|
|
|
|
func testPrefixVIsStripped() {
|
|
XCTAssertEqual(
|
|
AtlasVersionComparator.compare("V1.0.0", "1.0.0"),
|
|
.orderedSame
|
|
)
|
|
}
|
|
|
|
func testLowercaseVPrefix() {
|
|
XCTAssertEqual(
|
|
AtlasVersionComparator.compare("v1.0.0", "1.0.0"),
|
|
.orderedSame
|
|
)
|
|
}
|
|
|
|
func testNewerPatchVersion() {
|
|
XCTAssertTrue(
|
|
AtlasVersionComparator.isNewer("1.0.1", than: "1.0.0")
|
|
)
|
|
}
|
|
|
|
func testNewerMinorVersion() {
|
|
XCTAssertTrue(
|
|
AtlasVersionComparator.isNewer("1.1.0", than: "1.0.0")
|
|
)
|
|
}
|
|
|
|
func testNewerMajorVersion() {
|
|
XCTAssertTrue(
|
|
AtlasVersionComparator.isNewer("2.0.0", than: "1.99.99")
|
|
)
|
|
}
|
|
|
|
func testVPrefixNewerThanCurrent() {
|
|
XCTAssertTrue(
|
|
AtlasVersionComparator.isNewer("V1.30.0", than: "1.0.0")
|
|
)
|
|
}
|
|
|
|
func testVPrefixOlderThanCurrent() {
|
|
XCTAssertFalse(
|
|
AtlasVersionComparator.isNewer("V1.0.0", than: "1.0.1")
|
|
)
|
|
}
|
|
|
|
func testBothVPrefixed() {
|
|
XCTAssertTrue(
|
|
AtlasVersionComparator.isNewer("V2.0.0", than: "V1.99.99")
|
|
)
|
|
}
|
|
|
|
func testSameVersionIsNotNewer() {
|
|
XCTAssertFalse(
|
|
AtlasVersionComparator.isNewer("1.0.0", than: "1.0.0")
|
|
)
|
|
}
|
|
|
|
func testTwoComponentVersion() {
|
|
XCTAssertTrue(
|
|
AtlasVersionComparator.isNewer("1.1", than: "1.0")
|
|
)
|
|
}
|
|
|
|
func testMismatchedComponentCount() {
|
|
XCTAssertTrue(
|
|
AtlasVersionComparator.isNewer("1.0.1", than: "1.0")
|
|
)
|
|
}
|
|
}
|