Browse Source

Merge branch 'master' of https://github.com/n0shake/Clocker

pull/101/head
Abhishek 3 years ago
parent
commit
df4cff75f0
  1. 15
      Clocker/ClockerUnitTests/ClockerUnitTests.swift

15
Clocker/ClockerUnitTests/ClockerUnitTests.swift

@ -115,7 +115,20 @@ class ClockerUnitTests: XCTestCase {
XCTFail("Default preferences aren't in the correct format") XCTFail("Default preferences aren't in the correct format")
return 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 { currentFavourites = currentFavourites.filter {
let timezone = TimezoneData.customObject(from: $0) let timezone = TimezoneData.customObject(from: $0)

Loading…
Cancel
Save