Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
n0shake committed Jul 2, 2021
2 parents 2d21de0 + 5824f4e commit df4cff7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Clocker/ClockerUnitTests/ClockerUnitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit df4cff7

Please sign in to comment.