优化首页位置上报体验

This commit is contained in:
2026-07-10 11:44:56 +08:00
parent c03a625409
commit df547a16dc
8 changed files with 47 additions and 11 deletions

View File

@ -67,6 +67,27 @@ final class LocationReportServiceTests: XCTestCase {
XCTAssertTrue(stateStore.isOnline)
}
func testManualReportUsesLowerLocationAccuracy() async throws {
let reportJSON = """
{"code":100000,"msg":"success","data":{"staff_id":"staff-1","expired":0,"status":1}}
""".data(using: .utf8)!
let api = HomeAPI(client: APIClient(environment: .testing, session: MockURLSession(responses: [reportJSON])))
let stateStore = HomeLocationStateStore(store: appStore)
let locationProvider = MockLocationProvider()
let service = LocationReportService(
appStore: appStore,
locationStateStore: stateStore,
locationProvider: locationProvider
)
_ = try await service.manualReport(api: api)
XCTAssertEqual(
locationProvider.requestedSnapshotAccuracies,
[LocationReportService.manualReportDesiredAccuracy]
)
}
func testTooFrequentManualReportThrows() async throws {
let reportJSON = """
{"code":100000,"msg":"success","data":{"staff_id":"staff-1","expired":0,"status":1}}