diff --git a/Clocker/ClockerUITests/CopyToClipboardTests.swift b/Clocker/ClockerUITests/CopyToClipboardTests.swift index dbf60d1..6255b95 100644 --- a/Clocker/ClockerUITests/CopyToClipboardTests.swift +++ b/Clocker/ClockerUITests/CopyToClipboardTests.swift @@ -22,9 +22,10 @@ class CopyToClipboardTests: XCTestCase { func testFullCopy() throws { let cell = app.tables["FloatingTableView"].cells.firstMatch - let customLabel = cell.staticTexts["CustomNameLabelForCell"].value ?? "Nil Custom Label" + let customLabel = cell.staticTexts["CustomNameLabelForCell"] + guard let value = customLabel.value else { return } let time = cell.staticTexts["ActualTime"].value ?? "Nil Value" - let expectedValue = "\(customLabel) - \(time)" + let expectedValue = "\(value) - \(time)" // Tap to copy! cell.click() diff --git a/Clocker/ClockerUnitTests/AppDelegateTests.swift b/Clocker/ClockerUnitTests/AppDelegateTests.swift index 4d8e433..a4727d4 100644 --- a/Clocker/ClockerUnitTests/AppDelegateTests.swift +++ b/Clocker/ClockerUnitTests/AppDelegateTests.swift @@ -95,6 +95,7 @@ class AppDelegateTests: XCTestCase { func testCompactModeMenubarSetup() { let subject = NSApplication.shared.delegate as? AppDelegate + let olderTimezones = DataStore.shared().timezones() let timezone1 = TimezoneData() timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier @@ -108,17 +109,22 @@ class AppDelegateTests: XCTestCase { let statusItemHandler = subject?.statusItemForPanel() XCTAssertNotNil(statusItemHandler?.statusItem.view) // This won't be nil for compact mode - DataStore.shared().setTimezones([]) + DataStore.shared().setTimezones(olderTimezones) } func testStandardModeMenubarSetup() { + let olderTimezones = DataStore.shared().timezones() UserDefaults.standard.set(1, forKey: CLMenubarCompactMode) // Set the menubar mode to standard let subject = NSApplication.shared.delegate as? AppDelegate let statusItemHandler = subject?.statusItemForPanel() subject?.setupMenubarTimer() - XCTAssertEqual(statusItemHandler?.statusItem.button?.image?.name(), "LightModeIcon") + if olderTimezones.isEmpty { + XCTAssertEqual(statusItemHandler?.statusItem.button?.image?.name(), "LightModeIcon") + } else { + XCTAssertTrue(statusItemHandler?.statusItem.button?.title != nil) + } let timezone1 = TimezoneData() timezone1.timezoneID = TimeZone.autoupdatingCurrent.identifier @@ -132,8 +138,6 @@ class AppDelegateTests: XCTestCase { XCTAssertNil(subject?.statusItemForPanel().statusItem.view) // This will be nil for standard mode - DataStore.shared().setTimezones([]) - UserDefaults.standard.set(0, forKey: CLMenubarCompactMode) // Set the menubar mode back to compact } }