优化首页位置上报体验
This commit is contained in:
@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user