Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/code cleanup #971

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UIKit

class SearchOptionsDataSource: NSObject, UITableViewDataSource {
final class SearchOptionsDataSource: NSObject, UITableViewDataSource {

private var viewModel: SearchOptionsViewModelProtocol?

Expand Down
69 changes: 69 additions & 0 deletions UpcomingMoviesTests/Helpers/Mocks/SearchMoviesMockFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,72 @@ final class MockSearchMoviesResultInteractor: SearchMoviesResultInteractorProtoc
}

}

final class MockSearchOptionsViewModel: SearchOptionsViewModelProtocol {

var viewState: BehaviorBindable<SearchOptionsViewState> = .init(.emptyMovieVisits)

var needsContentReload: PublishBindable<Void> = .init()

var updateVisitedMovies: PublishBindable<Int> = .init()

var selectedDefaultSearchOption: PublishBindable<DefaultSearchOption> = .init()

var selectedMovieGenre: PublishBindable<(Int, String)> = .init()

var selectedRecentlyVisitedMovie: PublishBindable<(Int, String)> = .init()

var visitedMovieCells: [VisitedMovieCellViewModelProtocol] = .init()

var genreCells: [GenreSearchOptionCellViewModelProtocol] = .init()

var defaultSearchOptionsCells: [DefaultSearchOptionCellViewModelProtocol] = []

private(set) var loadGenresCallCount = 0
func loadGenres() {
loadGenresCallCount += 1
}

private(set) var loadVisitedMoviesCallCount = 0
func loadVisitedMovies() {
loadVisitedMoviesCallCount += 1
}

var sectionAtIndexResult: SearchOptionsSection = .defaultSearches
private(set) var sectionAtIndexCallCount = 0
func section(at index: Int) -> SearchOptionsSection {
sectionAtIndexCallCount += 1
return sectionAtIndexResult
}

var sectionIndexResult: Int?
private(set) var sectionIndexCallCount = 0
func sectionIndex(for section: SearchOptionsSection) -> Int? {
sectionIndexCallCount += 1
return sectionIndexResult
}

var buildRecentlyVisitedMoviesCellResult: RecentlyVisitedMoviesCellViewModelProtocol = RecentlyVisitedMoviesCellViewModel(visitedMovieCells: [])
private(set) var buildRecentlyVisitedMoviesCellCallCount = 0
func buildRecentlyVisitedMoviesCell() -> RecentlyVisitedMoviesCellViewModelProtocol {
buildRecentlyVisitedMoviesCellCallCount += 1
return buildRecentlyVisitedMoviesCellResult
}

private(set) var getDefaultSearchSelectionCallCount = 0
func getDefaultSearchSelection(by index: Int) {
getDefaultSearchSelectionCallCount += 1
}

private(set) var getMovieGenreSelectionCallCount = 0
func getMovieGenreSelection(by index: Int) {
getMovieGenreSelectionCallCount += 1
}

// swiftlint:disable identifier_name
private(set) var getRecentlyVisitedMovieSelectionCallCount = 0
func getRecentlyVisitedMovieSelection(by index: Int) {
getRecentlyVisitedMovieSelectionCallCount += 1
}

}
Loading