mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Removing Dead Code part 1 (#2234)
This commit is contained in:
@@ -624,7 +624,7 @@ class AttributedStringBuilderTests: XCTestCase {
|
||||
XCTFail("Couldn't find expected value.")
|
||||
}
|
||||
|
||||
private func checkAttachment(attributedString: AttributedString?, expectedRuns: Int, expectedAttachments: Int = 1) {
|
||||
private func checkAttachment(attributedString: AttributedString?, expectedRuns: Int) {
|
||||
guard let attributedString else {
|
||||
XCTFail("Could not build the attributed string")
|
||||
return
|
||||
|
||||
@@ -31,9 +31,6 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
}
|
||||
|
||||
private var audioPlayerSeekCallsSubject: PassthroughSubject<Double, Never>!
|
||||
private var audioPlayerSeekCalls: AnyPublisher<Double, Never> {
|
||||
audioPlayerSeekCallsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
private func buildAudioPlayerMock() -> AudioPlayerMock {
|
||||
let audioPlayerMock = AudioPlayerMock()
|
||||
@@ -115,7 +112,7 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
|
||||
func testReportError() async throws {
|
||||
XCTAssertEqual(audioPlayerState.playbackState, .stopped)
|
||||
audioPlayerState.reportError(AudioPlayerError.genericError)
|
||||
audioPlayerState.reportError()
|
||||
XCTAssertEqual(audioPlayerState.playbackState, .error)
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class AudioRecorderStateTests: XCTestCase {
|
||||
|
||||
func testReportError() async throws {
|
||||
XCTAssertEqual(audioRecorderState.recordingState, .stopped)
|
||||
audioRecorderState.reportError(AudioRecorderError.audioEngineFailure)
|
||||
audioRecorderState.reportError()
|
||||
XCTAssertEqual(audioRecorderState.recordingState, .error)
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,13 @@ import Foundation
|
||||
import XCTest
|
||||
|
||||
class BugReportServiceTests: XCTestCase {
|
||||
var bugReportService: BugReportServiceMock!
|
||||
var bugReportService: BugReportServiceProtocol!
|
||||
|
||||
override func setUpWithError() throws {
|
||||
bugReportService = BugReportServiceMock()
|
||||
bugReportService.underlyingCrashedLastRun = false
|
||||
bugReportService.submitBugReportProgressListenerReturnValue = .success(SubmitBugReportResponse(reportUrl: "https://www.example.com/123"))
|
||||
let bugReportServiceMock = BugReportServiceMock()
|
||||
bugReportServiceMock.underlyingCrashedLastRun = false
|
||||
bugReportServiceMock.submitBugReportProgressListenerReturnValue = .success(SubmitBugReportResponse(reportUrl: "https://www.example.com/123"))
|
||||
bugReportService = bugReportServiceMock
|
||||
}
|
||||
|
||||
func testInitialStateWithMockService() {
|
||||
|
||||
@@ -21,7 +21,7 @@ import XCTest
|
||||
@MainActor
|
||||
final class EmojiProviderTests: XCTestCase {
|
||||
func testWhenEmojisLoadedCategoriesAreLoadedFromLoader() async throws {
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"], skins: ["🙂"])
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"])
|
||||
let category = EmojiCategory(id: "test", emojis: [item])
|
||||
|
||||
let emojiLoaderMock = EmojiLoaderMock()
|
||||
@@ -34,7 +34,7 @@ final class EmojiProviderTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testWhenEmojisLoadedAndSearchStringEmptyAllCategoriesReturned() async throws {
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"], skins: ["🙂"])
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"])
|
||||
let category = EmojiCategory(id: "test", emojis: [item])
|
||||
|
||||
let emojiLoaderMock = EmojiLoaderMock()
|
||||
@@ -47,8 +47,8 @@ final class EmojiProviderTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testWhenEmojisLoadedSecondTimeCachedValuesAreUsed() async throws {
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"], skins: ["🙂"])
|
||||
let item2 = EmojiItem(label: "test2", unicode: "test2", keywords: ["3", "4"], shortcodes: ["3", "4"], skins: ["🙂"])
|
||||
let item = EmojiItem(label: "test", unicode: "test", keywords: ["1", "2"], shortcodes: ["1", "2"])
|
||||
let item2 = EmojiItem(label: "test2", unicode: "test2", keywords: ["3", "4"], shortcodes: ["3", "4"])
|
||||
let categoriesForFirstLoad = [EmojiCategory(id: "test",
|
||||
emojis: [item])]
|
||||
let categoriesForSecondLoad = [EmojiCategory(id: "test2",
|
||||
@@ -69,12 +69,12 @@ final class EmojiProviderTests: XCTestCase {
|
||||
func testWhenEmojisSearchedCorrectNumberOfCategoriesReturned() async throws {
|
||||
let searchString = "smile"
|
||||
var categories = [EmojiCategory]()
|
||||
let item0WithSearchString = EmojiItem(label: "emoji0", unicode: "\(searchString)_123", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"], skins: ["🙂"])
|
||||
let item1WithSearchString = EmojiItem(label: searchString, unicode: "emoji1", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"], skins: ["🙂"])
|
||||
let item2WithSearchString = EmojiItem(label: "emoji_2", unicode: "emoji_2", keywords: ["key1", "\(searchString)_123"], shortcodes: ["key1", "key2"], skins: ["🙂"])
|
||||
let item3WithSearchString = EmojiItem(label: "emoji_2", unicode: "emoji_2", keywords: ["key1", "key1"], shortcodes: ["key1", "\(searchString)_123"], skins: ["🙂"])
|
||||
let item4WithoutSearchString = EmojiItem(label: "emoji_3", unicode: "emoji_3", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"], skins: ["🙂"])
|
||||
let item5WithSearchString = EmojiItem(label: "emoji0", unicode: "\(searchString)_123", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"], skins: ["🙂"])
|
||||
let item0WithSearchString = EmojiItem(label: "emoji0", unicode: "\(searchString)_123", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"])
|
||||
let item1WithSearchString = EmojiItem(label: searchString, unicode: "emoji1", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"])
|
||||
let item2WithSearchString = EmojiItem(label: "emoji_2", unicode: "emoji_2", keywords: ["key1", "\(searchString)_123"], shortcodes: ["key1", "key2"])
|
||||
let item3WithSearchString = EmojiItem(label: "emoji_2", unicode: "emoji_2", keywords: ["key1", "key1"], shortcodes: ["key1", "\(searchString)_123"])
|
||||
let item4WithoutSearchString = EmojiItem(label: "emoji_3", unicode: "emoji_3", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"])
|
||||
let item5WithSearchString = EmojiItem(label: "emoji0", unicode: "\(searchString)_123", keywords: ["key1", "key1"], shortcodes: ["key1", "key1"])
|
||||
categories.append(EmojiCategory(id: "test",
|
||||
emojis: [item0WithSearchString,
|
||||
item1WithSearchString,
|
||||
|
||||
@@ -32,10 +32,8 @@ class HomeScreenViewModelTests: XCTestCase {
|
||||
viewModel = HomeScreenViewModel(userSession: MockUserSession(clientProxy: clientProxy,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock()),
|
||||
attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: ServiceLocator.shared.settings.permalinkBaseURL, mentionBuilder: MentionBuilder()),
|
||||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
}
|
||||
|
||||
|
||||
@@ -246,11 +246,11 @@ extension NotificationManagerTests: NotificationManagerDelegate {
|
||||
authorizationStatusWasGranted = false
|
||||
}
|
||||
|
||||
func shouldDisplayInAppNotification(_ service: ElementX.NotificationManagerProtocol, content: UNNotificationContent) -> Bool {
|
||||
func shouldDisplayInAppNotification(content: UNNotificationContent) -> Bool {
|
||||
shouldDisplayInAppNotificationReturnValue
|
||||
}
|
||||
|
||||
func notificationTapped(_ service: ElementX.NotificationManagerProtocol, content: UNNotificationContent) async {
|
||||
func notificationTapped(content: UNNotificationContent) async {
|
||||
notificationTappedDelegateCalled = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user