From f45175387cbd204eb08757e1593471ab17d0c041 Mon Sep 17 00:00:00 2001 From: Kuba Reinhard Date: Wed, 28 Sep 2022 14:18:18 +0200 Subject: [PATCH] Update Unit Tests --- .../DeviceAppleTVTests.swift | 12 ++++ .../PreviewDeviceTests/DeviceIpadTests.swift | 15 +++++ .../DeviceIphoneTests.swift | 29 ++++++++- .../PreviewDeviceTests/DeviceWatchTests.swift | 63 ++++++++++++++----- 4 files changed, 102 insertions(+), 17 deletions(-) diff --git a/Tests/PreviewDeviceTests/DeviceAppleTVTests.swift b/Tests/PreviewDeviceTests/DeviceAppleTVTests.swift index 28727ae..698d159 100644 --- a/Tests/PreviewDeviceTests/DeviceAppleTVTests.swift +++ b/Tests/PreviewDeviceTests/DeviceAppleTVTests.swift @@ -27,4 +27,16 @@ final class DeviceAppleTVTests: XCTestCase { let iphone: Device = .appleTV4K1080p XCTAssertEqual(iphone.rawValue, "Apple TV 4K (at 1080p)") } + + // MARK: - Apple TV 4K 2 Gen + + func testAppleTV4KGen2HasCorrectName() { + let iphone: Device = .appleTV4K_2Gen + XCTAssertEqual(iphone.rawValue, "Apple TV 4K (2nd generation)") + } + + func testAppleTV4KGen21080pHasCorretName() { + let iphone: Device = .appleTV4K1080p_2Gen + XCTAssertEqual(iphone.rawValue, "Apple TV 4K (at 1080p) (2nd generation)") + } } diff --git a/Tests/PreviewDeviceTests/DeviceIpadTests.swift b/Tests/PreviewDeviceTests/DeviceIpadTests.swift index 09cfaf1..10da314 100644 --- a/Tests/PreviewDeviceTests/DeviceIpadTests.swift +++ b/Tests/PreviewDeviceTests/DeviceIpadTests.swift @@ -41,6 +41,11 @@ final class DeviceIpadTests: XCTestCase { XCTAssertEqual(iphone.rawValue, "iPad Air (4th generation)") } + func testIpadAir_5GenHasCorretName() { + let ipad: Device = .ipadAir_5Gen + XCTAssertEqual(ipad.rawValue, "iPad Air (5th generation)") + } + // MARK: - Ipad mini 2, mini 3, mini 4, mini 5 func testIpadMini2HasCorretName() { @@ -132,8 +137,18 @@ final class DeviceIpadTests: XCTestCase { XCTAssertEqual(iphone.rawValue, "iPad Pro (11-inch) (2nd generation)") } + func testIpadPro11inch_3GenHasCorretName() { + let iphone: Device = .ipadPro11inch_3Gen + XCTAssertEqual(iphone.rawValue, "iPad Pro (11-inch) (3rd generation)") + } + func testIpadPro12_9inch_4GenHasCorretName() { let iphone: Device = .ipadPro12_9inch_4Gen XCTAssertEqual(iphone.rawValue, "iPad Pro (12.9-inch) (4th generation)") } + + func testIpadPro12_9inch_5GenHasCorretName() { + let ipad: Device = .ipadPro12_9inch_5Gen + XCTAssertEqual(ipad.rawValue, "iPad Pro (12.9-inch) (5th generation)") + } } diff --git a/Tests/PreviewDeviceTests/DeviceIphoneTests.swift b/Tests/PreviewDeviceTests/DeviceIphoneTests.swift index 4018369..def8bb0 100644 --- a/Tests/PreviewDeviceTests/DeviceIphoneTests.swift +++ b/Tests/PreviewDeviceTests/DeviceIphoneTests.swift @@ -57,7 +57,7 @@ final class DeviceIphoneTests: XCTestCase { XCTAssertEqual(iphone.rawValue, "iPhone 8 Plus") } - // MARK: - Iphone SE 1 Gen, SE 2 Gen + // MARK: - Iphone SE 1 Gen, SE 2 Gen, SE 3 Gen func testIphoneSE1GenHasCorretName() { let iphone: Device = .iphoneSE_1Gen @@ -69,6 +69,11 @@ final class DeviceIphoneTests: XCTestCase { XCTAssertEqual(iphone.rawValue, "iPhone SE (2nd generation)") } + func testIphoneSE3GenHasCorrectName() { + let iphone: Device = .iphoneSE_3Gen + XCTAssertEqual(iphone.rawValue, "iPhone SE (3rd generation)") + } + // MARK: - Iphone X, Xs, XsMax, Xr func testIphoneXHasCorretName() { @@ -151,4 +156,26 @@ final class DeviceIphoneTests: XCTestCase { let iphone: Device = .iphone13ProMax XCTAssertEqual(iphone.rawValue, "iPhone 13 Pro Max") } + + // MARK: - Iphone 14, 14 Plus, 14 Pro, 14 Pro Max + + func testIphone14HasCorrectName() { + let iphone: Device = .iphone14 + XCTAssertEqual(iphone.rawValue, "iPhone 14") + } + + func testIphone14PlusHasCorrectName() { + let iphone: Device = .iphone14Plus + XCTAssertEqual(iphone.rawValue, "iPhone 14 Plus") + } + + func testIphone14ProHasCorrectName() { + let iphone: Device = .iphone14Pro + XCTAssertEqual(iphone.rawValue, "iPhone 14 Pro") + } + + func testIphone14ProMaxHasCorrectName() { + let iphone: Device = .iphone14ProMax + XCTAssertEqual(iphone.rawValue, "iPhone 14 Pro Max") + } } diff --git a/Tests/PreviewDeviceTests/DeviceWatchTests.swift b/Tests/PreviewDeviceTests/DeviceWatchTests.swift index ca8a18a..a738ae6 100644 --- a/Tests/PreviewDeviceTests/DeviceWatchTests.swift +++ b/Tests/PreviewDeviceTests/DeviceWatchTests.swift @@ -13,95 +13,126 @@ final class DeviceWatchTests: XCTestCase { func testWatch_38mmHasCorretName() { let iphone: Device = .watch_38mm - XCTAssertEqual(iphone.rawValue, "Apple Watch - 38mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch (38mm)") } func testWatch_42mmHasCorretName() { let iphone: Device = .watch_42mm - XCTAssertEqual(iphone.rawValue, "Apple Watch - 42mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch (42mm)") } // MARK: - Watch Series 2 32mm, 42mm func testWatchSeries2_38mmHasCorretName() { let iphone: Device = .watchSeries2_38mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 2 - 38mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 2 (38mm)") } func testWatchSeries2_42mmHasCorretName() { let iphone: Device = .watchSeries2_42mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 2 - 42mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 2 (42mm)") } // MARK: - Watch Series 3 32mm, 42mm func testWatchSeries3_38mmHasCorretName() { let iphone: Device = .watchSeries3_38mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 3 - 38mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 3 (38mm)") } func testWatchSeries3_42mmHasCorretName() { let iphone: Device = .watchSeries3_42mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 3 - 42mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 3 (42mm)") } // MARK: - Watch Series 4 40mm, 44mm func testWatchSeries4_40mmHasCorretName() { let iphone: Device = .watchSeries4_40mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 4 - 40mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 4 (40mm)") } func testWatchSeries4_44mmHasCorretName() { let iphone: Device = .watchSeries4_44mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 4 - 44mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 4 (44mm)") } // MARK: - Watch Series 5 40mm, 44mm func testWatchSeries5_40mmHasCorretName() { let iphone: Device = .watchSeries5_40mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 5 - 40mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 5 (40mm)") } func testWatchSeries5_44mmHasCorretName() { let iphone: Device = .watchSeries5_44mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 5 - 44mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 5 (44mm)") } // MARK: - Watch Series 6 40mm, 44mm func testWatchSeries6_40mmHasCorretName() { let iphone: Device = .watchSeries6_40mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 6 - 40mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 6 (40mm)") } func testWatchSeries6_44mmHasCorretName() { let iphone: Device = .watchSeries6_44mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 6 - 44mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 6 (44mm)") } // MARK: - Watch Series 7 41mm, 45mm func testWatchSeries7_41mmHasCorretName() { let iphone: Device = .watchSeries7_41mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 7 - 41mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 7 (41mm)") } func testWatchSeries7_45mmHasCorretName() { let iphone: Device = .watchSeries7_45mm - XCTAssertEqual(iphone.rawValue, "Apple Watch Series 7 - 45mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch Series 7 (45mm)") + } + + // MARK: - Watch Series 8 41mm, 45mm + + func testWatchSeries8_41mmHasCorrectName() { + let watch: Device = .watchSeries8_41mm + XCTAssertEqual(watch.rawValue, "Apple Watch Series 8 (41mm)") + } + + func testWatchSeries8_45mmHasCorrectName() { + let watch: Device = .watchSeries8_45mm + XCTAssertEqual(watch.rawValue, "Apple Watch Series 8 (45mm)") } // MARK: - Watch SE 40mm, 44mm func testWatchSE_40mmHasCorretName() { let iphone: Device = .watchSE_40mm - XCTAssertEqual(iphone.rawValue, "Apple Watch SE - 40mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch SE (40mm)") } func testWatchSE_44mmmmHasCorretName() { let iphone: Device = .watchSE_44mm - XCTAssertEqual(iphone.rawValue, "Apple Watch SE - 44mm") + XCTAssertEqual(iphone.rawValue, "Apple Watch SE (44mm)") + } + + // MARK: - Watch SE 2 Gen 40mm, 44mm + + func testWatchSE_2Gen_40mmHasCorrectName() { + let watch: Device = .watchSE_2Gen_40mm + XCTAssertEqual(watch.rawValue, "Apple Watch SE (40mm) (2nd generation)") + } + + func testWatchSE_2Gen_44mmHasCorrectName() { + let watch: Device = .watchSE_2Gen_44mm + XCTAssertEqual(watch.rawValue, "Apple Watch SE (44mm) (2nd generation)") + } + + // MARK: - Watch Ultra 49mm + + func testWatchUltra_49mmHasCorrectName() { + let watch: Device = .watchUltra_49mm + XCTAssertEqual(watch.rawValue, "Apple Watch Ultra (49mm)") } }