Skip to content

Commit

Permalink
Update iPhone Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentneo committed Sep 24, 2024
1 parent 555673a commit c667cae
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Tests/DeviceModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,26 @@ class DeviceModelTests: XCTestCase {
XCTAssert(deviceModel == .iPhone15ProMax , "DeviceModel - .iPhone15ProMax is failing")
}

func testDeviceModelIPhone16() {
let deviceModel = DeviceModel(identifier: Identifier("iPhone17,3"))
XCTAssert(deviceModel == .iPhone16, "DeviceModel - .iPhone16 is failing")
}

func testDeviceModelIPhone16Plus() {
let deviceModel = DeviceModel(identifier: Identifier("iPhone17,4"))
XCTAssert(deviceModel == .iPhone16Plus, "DeviceModel - .iPhone16Plus is failing")
}

func testDeviceModelIPhone16Pro() {
let deviceModel = DeviceModel(identifier: Identifier("iPhone17,1"))
XCTAssert(deviceModel == .iPhone16Pro, "DeviceModel - .iPhone16Pro is failing")
}

func testDeviceModelIPhone16ProMax() {
let deviceModel = DeviceModel(identifier: Identifier("iPhone17,2"))
XCTAssert(deviceModel == .iPhone16ProMax, "DeviceModel - .iPhone16ProMax is failing")
}

// MARK: - iPad Device Model tests

func testDeviceModelIPadFirstGen() {
Expand Down Expand Up @@ -523,7 +543,8 @@ class DeviceModelTests: XCTestCase {

func testHasDynamicIsland() {
let withModels: [DeviceModel] = [.iPhone14Pro, .iPhone14ProMax,
.iPhone15, .iPhone15Plus, .iPhone15Pro, .iPhone15ProMax]
.iPhone15, .iPhone15Plus, .iPhone15Pro, .iPhone15ProMax,
.iPhone16, .iPhone16Plus, .iPhone16Pro, .iPhone16ProMax]

let withoutModels: [DeviceModel] = DeviceModel.allCases.filter( { !withModels.contains($0) })

Expand Down
16 changes: 16 additions & 0 deletions Tests/IdentifierTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ class IdentifierTests: XCTestCase {
#if os(iOS)
// MARK: - iPhone String Description tests

func testDisplayStringiPhone17v4() {
XCTAssert(Identifier("iPhone17,4").description == "iPhone 16 Plus", "iPhone17,4 is failing to produce a common device model string")
}

func testDisplayStringiPhone17v3() {
XCTAssert(Identifier("iPhone17,3").description == "iPhone 16", "iPhone17,3 is failing to produce a common device model string")
}

func testDisplayStringiPhone17v2() {
XCTAssert(Identifier("iPhone17,2").description == "iPhone 16 Pro Max", "iPhone17,2 is failing to produce a common device model string")
}

func testDisplayStringiPhone17v1() {
XCTAssert(Identifier("iPhone17,1").description == "iPhone 16 Pro", "iPhone17,1 is failing to produce a common device model string")
}

func testDisplayStringiPhone16v2() {
XCTAssert(Identifier("iPhone16,2").description == "iPhone 15 Pro Max", "iPhone16,2 is failing to produce a common device model string")
}
Expand Down

0 comments on commit c667cae

Please sign in to comment.