Browse Source

Test fixes.

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
1812f3ec62
  1. 5
      Clocker/ClockerUITests/CopyToClipboardTests.swift
  2. 10
      Clocker/ClockerUnitTests/AppDelegateTests.swift

5
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()

10
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()
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
}
}

Loading…
Cancel
Save