Files
fuelboard/FuelBoardTests/Tests/FuelBoardSharedTests/SortModeNamesTests.swift
T
FuelBoard Contributor 801f969644 Stations sort: "Worth the Drive" segment is now "Best Value"
The third sort segment, the caption line it drives on the Stations tab, and the
Settings sentence about sorting now read "Best Value" — that is
SortMode.worthTheDrive.displayName plus the two copy sites that name the sort.

The feature that backs it keeps the name "Worth the Drive": the Settings toggle
("Enable Worth the Drive"), the Fuel Savings section header and footer, the sheet
header "Worth the drive?", the "Worth the Drive unavailable: …" text and
FuelSavingsStatus.worthTheDrive's own wording are all unchanged.

The enum's raw value stays `worthTheDrive`, so stored sort preferences and widget
configs keep decoding — only the label moved.

3 new tests pin the three sort names, the stability of the raw values, and the
fact that the feature's own wording did not change (172 total, 0 failures).

Verified on the simulator: the Stations segmented control reads
Closest | Cheapest | Best Value.
2026-10-11 20:01:32 +01:00

31 lines
1.4 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 testTheFeatureItselfIsStillCalledWorthTheDrive() {
// Only the sort was renamed — the status wording the feature produces
// keeps its own name.
XCTAssertEqual(FuelSavingsStatus.worthTheDrive.displayName, "Worth the drive")
XCTAssertEqual(FuelSavingsStatus.notWorthTheDrive.displayName, "Not worth the drive")
}
}