Skip to content

Commit

Permalink
Merge pull request #976 from DeluxeAlonso/feature/code-cleanup
Browse files Browse the repository at this point in the history
Feature/code cleanup
  • Loading branch information
DeluxeAlonso authored Sep 19, 2024
2 parents 0204b2f + a2e429e commit f392ca7
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,44 @@ final class SearchOptionsDataSourceTests: XCTestCase {
XCTAssertEqual(numberOfRowsInSection, 1)
}

func testCellForRowGenres() {
// Arrange
let tableView = UITableView()
tableView.registerNib(cellType: GenreSearchOptionTableViewCell.self)
viewModel.sectionAtIndexResult = .genres
viewModel.genreCells = [GenreSearchOptionCellViewModel(genre: GenreModel(.init(id: 1, name: "Genre 2")))]
// Act
let cellForRow = dataSource.tableView(tableView, cellForRowAt: IndexPath(row: 0, section: 0))
// Assert
XCTAssertNotNil(cellForRow as? GenreSearchOptionTableViewCell)
}

func testCellForRowDefaultSearches() {
// Arrange
let tableView = UITableView()
tableView.register(cellType: DefaultSearchOptionTableViewCell.self)
viewModel.sectionAtIndexResult = .defaultSearches
viewModel.defaultSearchOptionsCells = [
DefaultSearchOptionCellViewModel(defaultSearchOption: .popular),
DefaultSearchOptionCellViewModel(defaultSearchOption: .topRated)
]
// Act
let cellForRow = dataSource.tableView(tableView, cellForRowAt: IndexPath(row: 0, section: 0))
// Assert
XCTAssertNotNil(cellForRow as? DefaultSearchOptionTableViewCell)
}

func testCellForRowRecentlyVisited() {
// Arrange
let tableView = UITableView()
tableView.registerNib(cellType: RecentlyVisitedMoviesTableViewCell.self)
viewModel.sectionAtIndexResult = .recentlyVisited
// Act
let cellForRow = dataSource.tableView(tableView, cellForRowAt: IndexPath(row: 0, section: 0))
// Assert
XCTAssertNotNil(cellForRow as? RecentlyVisitedMoviesTableViewCell)
}

func testDidSelectMovie() {
// Act
dataSource.recentlyVisitedMoviesTableViewCell(RecentlyVisitedMoviesTableViewCell(), didSelectMovieAt: IndexPath(row: 0, section: 0))
Expand Down

0 comments on commit f392ca7

Please sign in to comment.