From 801f9696443a30466b99bfe3ac982b51f12fc10b Mon Sep 17 00:00:00 2001 From: FuelBoard Contributor Date: Sun, 11 Oct 2026 20:01:32 +0100 Subject: [PATCH] Stations sort: "Worth the Drive" segment is now "Best Value" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- FuelBoard/SettingsView.swift | 2 +- FuelBoard/StationsView.swift | 2 +- .../SortModeNamesTests.swift | 30 +++++++++++++++++++ Shared/FuelStore.swift | 6 +++- 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 FuelBoardTests/Tests/FuelBoardSharedTests/SortModeNamesTests.swift diff --git a/FuelBoard/SettingsView.swift b/FuelBoard/SettingsView.swift index 75766e3..f631b06 100644 --- a/FuelBoard/SettingsView.swift +++ b/FuelBoard/SettingsView.swift @@ -190,7 +190,7 @@ struct SettingsView: View { .accessibilityLabel("Typical fill-up") .accessibilityValue(fillUpText) if !fuelSavingsSettings.isConfigured && fuelSavingsSettings.enabled { - Text("Set a realistic UK MPG and fill-up amount before Worth the Drive appears in sorting.") + Text("Set a realistic UK MPG and fill-up amount before Best Value appears in sorting.") .font(.caption) .foregroundStyle(.orange) } diff --git a/FuelBoard/StationsView.swift b/FuelBoard/StationsView.swift index 5e09da3..f96bf6c 100644 --- a/FuelBoard/StationsView.swift +++ b/FuelBoard/StationsView.swift @@ -49,7 +49,7 @@ struct StationsView: View { switch sortMode { case .closest: mode = "Closest" case .cheapest: mode = "Cheapest" - case .worthTheDrive: mode = "Worth the Drive" + case .worthTheDrive: mode = "Best Value" } let tapHint = stationTapAction == .openMap ? "tap a station for directions." diff --git a/FuelBoardTests/Tests/FuelBoardSharedTests/SortModeNamesTests.swift b/FuelBoardTests/Tests/FuelBoardSharedTests/SortModeNamesTests.swift new file mode 100644 index 0000000..338968d --- /dev/null +++ b/FuelBoardTests/Tests/FuelBoardSharedTests/SortModeNamesTests.swift @@ -0,0 +1,30 @@ +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") + } +} diff --git a/Shared/FuelStore.swift b/Shared/FuelStore.swift index 6fa6875..5e2353d 100644 --- a/Shared/FuelStore.swift +++ b/Shared/FuelStore.swift @@ -53,7 +53,11 @@ enum SortMode: String, Codable, CaseIterable, Identifiable { switch self { case .cheapest: return "Cheapest" case .closest: return "Closest" - case .worthTheDrive: return "Worth the Drive" + // "Best Value" is the user-facing name of this sort. The raw value stays + // `worthTheDrive` so stored preferences keep decoding, and it is the SORT + // that is called Best Value — the Fuel Savings feature itself is still + // "Worth the Drive" (its Settings toggle, section and sheet header). + case .worthTheDrive: return "Best Value" } } }