Browse Source

Update ClockerUnitTests.swift

pull/101/head
Abhishek 3 years ago
parent
commit
5824f4e6da
  1. 17
      Clocker/ClockerUnitTests/ClockerUnitTests.swift

17
Clocker/ClockerUnitTests/ClockerUnitTests.swift

@ -115,8 +115,21 @@ class ClockerUnitTests: XCTestCase {
XCTFail("Default preferences aren't in the correct format")
return
}
let oldCount = currentFavourites.count
// Check if timezone with test identifier is present.
let filteredCount = currentFavourites.filter {
let timezone = TimezoneData.customObject(from: $0)
return timezone?.placeID == "TestIdentifier"
}
// California is absent. Add it!
if filteredCount.count == 0 {
let timezoneData = TimezoneData(with: california)
let operationsObject = TimezoneDataOperations(with: timezoneData)
operationsObject.saveObject()
}
let oldCount = (defaults.object(forKey: CLDefaultPreferenceKey) as? [Data])?.count ?? 0
currentFavourites = currentFavourites.filter {
let timezone = TimezoneData.customObject(from: $0)
return timezone?.placeID != "TestIdentifier"

Loading…
Cancel
Save