From 3183703a63b2789d7c78826d79a24ddc5bf37cc2 Mon Sep 17 00:00:00 2001 From: Islam <2553451+qalandarov@users.noreply.github.com> Date: Wed, 1 Oct 2025 12:16:59 +0100 Subject: [PATCH] Fix broken build + uncover localization tests (#702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move LocalizationCatalogTests out of Localization/ SPM is treating all the files under Localization as a resource as per the Package.swift, hence it’s not even building it * Use a class object vs struct to fix build issue * Explicitly check that the output is not a l10n key * Remove skipped test --- bitchatTests/EndToEnd/PrivateChatE2ETests.swift | 8 -------- .../{Localization => }/LocalizationCatalogTests.swift | 2 +- bitchatTests/LocationNotesManagerTests.swift | 6 +++++- 3 files changed, 6 insertions(+), 10 deletions(-) rename bitchatTests/{Localization => }/LocalizationCatalogTests.swift (99%) diff --git a/bitchatTests/EndToEnd/PrivateChatE2ETests.swift b/bitchatTests/EndToEnd/PrivateChatE2ETests.swift index a1176ac4..928b71e6 100644 --- a/bitchatTests/EndToEnd/PrivateChatE2ETests.swift +++ b/bitchatTests/EndToEnd/PrivateChatE2ETests.swift @@ -274,14 +274,6 @@ final class PrivateChatE2ETests: XCTestCase { wait(for: [expectation], timeout: TestConstants.defaultTimeout) } - // MARK: - Error Handling Tests - - // NOTE: This test relied on MessageRetryService which has been removed - - func testDuplicateAckPrevention() throws { - throw XCTSkip("DeliveryTracker/ACK flow removed; test not applicable") - } - // MARK: - Helper Methods private func createMockService(peerID: String, nickname: String) -> MockBluetoothMeshService { diff --git a/bitchatTests/Localization/LocalizationCatalogTests.swift b/bitchatTests/LocalizationCatalogTests.swift similarity index 99% rename from bitchatTests/Localization/LocalizationCatalogTests.swift rename to bitchatTests/LocalizationCatalogTests.swift index 68c0f85c..0ec8a604 100644 --- a/bitchatTests/Localization/LocalizationCatalogTests.swift +++ b/bitchatTests/LocalizationCatalogTests.swift @@ -248,7 +248,7 @@ final class LocalizationCatalogTests: XCTestCase { /// the test bundle, preventing false positives where localization keys are /// returned instead of translated strings. private func appBundle() -> Bundle { - Bundle(for: BitchatApp.self) + Bundle(for: ChatViewModel.self) } /// Tests to prevent regression of the pluralization format string issue diff --git a/bitchatTests/LocationNotesManagerTests.swift b/bitchatTests/LocationNotesManagerTests.swift index acf71568..29ebf3af 100644 --- a/bitchatTests/LocationNotesManagerTests.swift +++ b/bitchatTests/LocationNotesManagerTests.swift @@ -22,6 +22,8 @@ final class LocationNotesManagerTests: XCTestCase { XCTAssertEqual(manager.state, .noRelays) XCTAssertTrue(manager.initialLoadComplete) XCTAssertEqual(manager.errorMessage, String(localized: "location_notes.error.no_relays")) + // Make sure we're getting an actual translated value and not the localization key + XCTAssertNotEqual(manager.errorMessage, "location_notes.error.no_relays") } func testSendWhenNoRelaysSurfacesError() { @@ -40,7 +42,9 @@ final class LocationNotesManagerTests: XCTestCase { XCTAssertFalse(sendCalled) XCTAssertEqual(manager.state, .noRelays) - XCTAssertEqual(manager.errorMessage, String(localized: "location_notes.error.no_relays")) + XCTAssertEqual(manager.errorMessage, String(localized: "location_notes.error.no_relays")) + // Make sure we're getting an actual translated value and not the localization key + XCTAssertNotEqual(manager.errorMessage, "location_notes.error.no_relays") } func testSubscribeUsesGeoRelaysAndAppendsNotes() {