Skip to content

Commit

Permalink
fix: Fix UTCorePlatform test on iOS platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Mar 21, 2024
1 parent c94da92 commit 7c4892c
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions Tests/InfomaniakCoreTests/Platform/UTCorePlatform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,36 @@
import InfomaniakCore
import XCTest

final class UTCorePlatform: XCTestCase {
// MARK: - appVersionLabel

func testVersionLabel() {
#if canImport(UIKit)

@available(iOS 13.0, *) final class UTCorePlatform: XCTestCase {
func testVersionLabel_ios() {
// GIVEN
let expectedPrefix = "xctest iOS version"

// WHEN
let versionLabel = CorePlatform.appVersionLabel(fallbackAppName: "xctest")

// THEN
XCTAssertTrue(versionLabel.hasPrefix(expectedPrefix), "wrong text, got :\(versionLabel)")
}
}

#else

@available(macOS 10.15, *) final class UTCorePlatform: XCTestCase {
func testVersionLabel_mac() {
// GIVEN
let expectedPrefix = "xctest macOS version"

// WHEN
let versionLabel = CorePlatform.appVersionLabel(fallbackAppName: "xctest")

// THEN
XCTAssertTrue(versionLabel.hasPrefix(expectedPrefix))
XCTAssertTrue(versionLabel.hasPrefix(expectedPrefix), "wrong text, got :\(versionLabel)")
}
}

#endif

0 comments on commit 7c4892c

Please sign in to comment.