mirror of
https://github.com/xweiba/location-spoofer.git
synced 2026-09-27 00:51:55 +08:00
fix: 优化启动引导、坐标处理和日志管理
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import XCTest
|
||||
@testable import PaopaoLocationSpoofer
|
||||
|
||||
final class RuntimeLogStoreTests: XCTestCase {
|
||||
func testRetentionCutoffIsExactlyThreeDays() {
|
||||
let now = Date(timeIntervalSince1970: 1_800_000_000)
|
||||
|
||||
XCTAssertEqual(
|
||||
RuntimeLogStore.retentionCutoff(now: now),
|
||||
now.addingTimeInterval(-3 * 24 * 60 * 60)
|
||||
)
|
||||
}
|
||||
|
||||
func testRetentionKeepsCutoffAndNewerEntriesOnly() {
|
||||
let now = Date(timeIntervalSince1970: 1_800_000_000)
|
||||
let cutoff = RuntimeLogStore.retentionCutoff(now: now)
|
||||
let expired = RuntimeLogEntry(timestamp: cutoff.addingTimeInterval(-0.001), source: "APP", level: .info, category: "Test", message: "expired")
|
||||
let boundary = RuntimeLogEntry(timestamp: cutoff, source: "APP", level: .info, category: "Test", message: "boundary")
|
||||
let recent = RuntimeLogEntry(timestamp: now, source: "CORE", level: .warning, category: "Proxy", message: "recent")
|
||||
|
||||
XCTAssertEqual(
|
||||
RuntimeLogStore.retainedEntries([expired, boundary, recent], now: now),
|
||||
[boundary, recent]
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user