Following the sort-segment rename, the rest of the user-facing "Worth the Drive"
copy moves to "Best Value".
- Settings: the toggle is now just "Best Value" (was "Enable Worth the Drive"),
and the narrative footer opens "Best Value estimates fuel cost only, …".
- More info sheet: the section header is "Best Value" (was "Worth the drive?"),
and the section itself is now conditional. `fuelSavings` is nil whenever the
feature is off — `savingsLookup` returns nil when it is not configured — so
the heading is never left dangling over an empty section while the feature is
disabled.
- The unavailable text reads "Best Value unavailable: …".
- Comments and doc comments that named the sort were updated so they match the
UI instead of contradicting it.
Deliberately unchanged: the enum's raw value stays `worthTheDrive`, so stored
sort preferences and widget configs keep decoding, and FuelSavingsStatus keeps
its verdict wording ("Worth the drive" / "Not worth the drive") — that describes
a station's verdict rather than the feature, and is not shown in the UI.
Verified on the simulator: with the feature OFF the more info sheet shows
Address / Distance / Directions and no heading at all; with it ON the sheet
shows the "Best Value" section; Settings reads "Fuel Savings" / "Best Value"
with no "Enable" anywhere. 172 tests, 0 failures.
33 lines
1.6 KiB
Swift
33 lines
1.6 KiB
Swift
import XCTest
|
|
@testable import FuelBoardShared
|
|
|
|
/// User-facing copy: the Fuel Savings SORT is called "Best Value" (renamed on the
|
|
/// user's instruction from "Worth the Drive"), while the feature that backs it
|
|
/// keeps the name "Worth the Drive" in Settings and on the sheet. Pin both so
|
|
/// neither drifts by accident.
|
|
final class SortModeNamesTests: XCTestCase {
|
|
|
|
func testSortModeNames() {
|
|
XCTAssertEqual(SortMode.cheapest.displayName, "Cheapest")
|
|
XCTAssertEqual(SortMode.closest.displayName, "Closest")
|
|
XCTAssertEqual(SortMode.worthTheDrive.displayName, "Best Value")
|
|
}
|
|
|
|
func testRawValueIsUnchangedSoStoredPreferencesKeepDecoding() {
|
|
// The label is copy; the raw value is persisted state. Renaming the one
|
|
// must never move the other.
|
|
XCTAssertEqual(SortMode.worthTheDrive.rawValue, "worthTheDrive")
|
|
XCTAssertEqual(SortMode(rawValue: "worthTheDrive"), .worthTheDrive)
|
|
XCTAssertEqual(SortMode.allCases.map(\.rawValue), ["cheapest", "closest", "worthTheDrive"])
|
|
}
|
|
|
|
func testTheVerdictWordingIsUnchanged() {
|
|
// The feature and its sort are both called "Best Value" in user-facing
|
|
// copy now (Settings toggle + narrative, the sheet's section header).
|
|
// FuelSavingsStatus's own wording describes a VERDICT rather than the
|
|
// feature, and is not shown in the UI, so it keeps the drive phrasing.
|
|
XCTAssertEqual(FuelSavingsStatus.worthTheDrive.displayName, "Worth the drive")
|
|
XCTAssertEqual(FuelSavingsStatus.notWorthTheDrive.displayName, "Not worth the drive")
|
|
}
|
|
}
|