Files
ShadowsocksX-NG/ShadowsocksX-NG2/Tests/Settings/SettingsWorkflowInterfaceTests+CommitFailures.swift
Qiu YuzhouandDeepSeek Harness 5872015ca0 test: drop dead scaffolding assertions
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>
2026-10-21 02:23:28 +08:00

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)
}
}