Skip to content

Commit

Permalink
try to fix github action failure
Browse files Browse the repository at this point in the history
  • Loading branch information
hank121314 committed Dec 29, 2023
1 parent 0ece716 commit 375ae41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Tests/DefaultsTests/Defaults+iCloudTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ final class DefaultsICloudTests: XCTestCase {
func testICloudInitialize() async {
let name = Defaults.Key<String>("testICloudInitialize_name", default: "0", iCloud: true)
let quality = Defaults.Key<Double>("testICloudInitialize_quality", default: 0.0, iCloud: true)
// Not sure why github action will not trigger a observation callback after initialization, cannot reproduce in local.
Defaults.iCloud.syncWithoutWaiting()
await Defaults.iCloud.sync()
XCTAssertEqual(mockStorage.object(forKey: name.name), "0")
XCTAssertEqual(mockStorage.object(forKey: quality.name), 0.0)
Expand Down Expand Up @@ -180,7 +182,7 @@ final class DefaultsICloudTests: XCTestCase {
let quality = Defaults.Key<Double>("testSyncKeysFromLocal_quality", default: 0.0)
let name_expected = ["1", "2", "3", "4", "5", "6", "7"]
let quality_expected = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0]
NSUbiquitousKeyValueStore.default.object(forKey: quality.name)

for index in 0..<name_expected.count {
Defaults[name] = name_expected[index]
Defaults[quality] = quality_expected[index]
Expand Down Expand Up @@ -245,6 +247,8 @@ final class DefaultsICloudTests: XCTestCase {
func testICloudInitializeFromDetached() async {
let task = Task.detached {
let name = Defaults.Key<String>("testICloudInitializeFromDetached_name", default: "0", iCloud: true)
// Not sure why github action will not trigger a observation callback after initialization, cannot reproduce in local.
Defaults.iCloud.syncWithoutWaiting()
await Defaults.iCloud.sync()
XCTAssertEqual(mockStorage.object(forKey: name.name), "0")
}
Expand Down

0 comments on commit 375ae41

Please sign in to comment.