mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-08 10:54:50 +00:00
Six sites re-asserted the predicate waitUntilRuntimeSettles already checks, with no suspension point in between, so they could never fail; their intent messages are folded into comments where one was not already stated. Two commit-failure cases asserted the fake's bookkeeping (updateCalls stays empty) which the fake guarantees by throwing before recording; the outcome and committed-snapshot assertions already prove the real behavior. Also drop a no-op loop that mutated a discarded struct copy, a duplicated isWellFormed line, two WorkspaceRoute cases subsumed by the constructor and the publish-count case, a duplicated presentation-message assertion, and the round-trip halves of two payload-shape cases already covered case-by-case. Co-Authored-By: DeepSeek Harness <noreply@deepseek.com>
26 lines
1016 B
Swift
26 lines
1016 B
Swift
import XCTest
|
|
|
|
@testable import ShadowsocksX_NG2
|
|
|
|
@MainActor
|
|
extension SettingsWorkflowInterfaceTests {
|
|
func testPortSettingsPersistenceFailurePreservesCommittedSnapshot() async {
|
|
let original = committedSettingsForItemSaveTests()
|
|
committing.committedSettings = original
|
|
committing.updateError = ProxyListeningStoreError.ioFailure(detail: "disk full")
|
|
let workflow = makeWorkflow()
|
|
let edited = SettingsPortDraft(socksPort: 12_096, httpPort: 12_097)
|
|
workflow.refreshPortEditorOccupancy(for: edited)
|
|
await waitUntil(workflow.canSavePortSettings(edited))
|
|
|
|
let outcome = await workflow.savePortSettings(edited)
|
|
|
|
XCTAssertEqual(
|
|
outcome, .commitFailed(.store(.ioFailure(detail: "disk full"))))
|
|
XCTAssertEqual(workflow.lastFailure, .store(.ioFailure(detail: "disk full")))
|
|
XCTAssertTrue(workflow.lastFailure?.presentableMessage.contains("偏好文件") == true)
|
|
XCTAssertEqual(committing.committedSettings, original)
|
|
XCTAssertFalse(workflow.isCommitting)
|
|
}
|
|
}
|