Files
hapi/ios/Packages/HapiKit/Tests/HapiClientTests/Settings/LiveActivityPrefsTests.swift
T
5f511d7684 feat(ios): polish session widgets and live activity surfaces
- Group the large widget into running/active sections, show up to nine
  sessions, and use the last human prompt as the subtitle.
- Show compact status icons plus web-style relative times, right-aligned.
- Mirror the per-install push key into the protected App Group container so
  the Live Activity extension and NSE can decrypt while the data-protection
  Keychain is unavailable on the Lock Screen.
- Redesign the Lock Screen card and Dynamic Island compact/expanded/minimal
  states; Live Activities are now opt-in and recovered activities are ended
  when disabled.
- Rename the app and widget display name to Happy Coding; bump the local
  build to 10.

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-07 00:22:34 +08:00

31 lines
1010 B
Swift

import Foundation
import HapiClient
import Testing
@MainActor
@Suite("Live Activity prefs")
struct LiveActivityPrefsTests {
private func makeDefaults() throws -> (UserDefaults, String) {
let suiteName = "LiveActivityPrefsTests-\(UUID().uuidString)"
let defaults = try #require(UserDefaults(suiteName: suiteName))
return (defaults, suiteName)
}
@Test func defaultsToDisabledAndRoundTrips() throws {
let (defaults, suiteName) = try makeDefaults()
defer { defaults.removePersistentDomain(forName: suiteName) }
#expect(!LiveActivityPrefs(defaults: defaults).enabled)
LiveActivityPrefs(defaults: defaults).setEnabled(true)
#expect(LiveActivityPrefs(defaults: defaults).enabled)
LiveActivityPrefs(defaults: defaults).setEnabled(false)
#expect(!LiveActivityPrefs(defaults: defaults).enabled)
}
@Test func storageKeyIsStable() {
#expect(LiveActivityPrefs.enabledKey == "settings.liveActivities")
}
}