Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TablePro/Core/Sync/CloudKitSyncEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ actor CloudKitSyncEngine {
}

func currentAccountId() async throws -> String? {
guard let container else { return nil }
guard let container else { throw SyncError.accountUnavailable }
return try await container.userRecordID().recordName
}

Expand Down
9 changes: 5 additions & 4 deletions TableProTests/Core/Sync/CloudKitSyncEngineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ struct CloudKitSyncEngineTests {
}
}

@Test("currentAccountId returns nil without iCloud entitlement")
func currentAccountIdReturnsNil() async throws {
@Test("currentAccountId throws accountUnavailable without iCloud entitlement")
func currentAccountIdThrows() async throws {
try skipIfEntitled()
let engine = CloudKitSyncEngine()
let accountId = try await engine.currentAccountId()
#expect(accountId == nil)
await #expect(throws: SyncError.accountUnavailable) {
_ = try await engine.currentAccountId()
}
}
}
Loading