Skip to content

Commit

Permalink
Merge pull request #889 from DeluxeAlonso/feature/code-cleanup
Browse files Browse the repository at this point in the history
Feature/code cleanup
  • Loading branch information
DeluxeAlonso committed May 8, 2024
2 parents dbb3a03 + 86f66c2 commit 71855f5
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import XCTest
@testable import UpcomingMovies
import UpcomingMoviesDomain

final class SavedMoviesViewModelTests: XCTestCase {

Expand Down Expand Up @@ -38,7 +37,7 @@ final class SavedMoviesViewModelTests: XCTestCase {

func testGetCollectionListPopulated() {
// Arrange
let moviestoTest = [Movie.with(id: 1), Movie.with(id: 2)]
let moviestoTest = [MockMovieProtocol(id: 1), MockMovieProtocol(id: 2)]
var statesToReceive: [SimpleViewState<MovieProtocol>] = [.paging(moviestoTest, next: 2), .populated(moviestoTest)]

let expectation = XCTestExpectation(description: "Should get populated state after a paging state")
Expand All @@ -57,7 +56,7 @@ final class SavedMoviesViewModelTests: XCTestCase {

func testGetCollectionListPaging() {
// Arrange
let moviesToTest = [Movie.with(id: 1), Movie.with(id: 2)]
let moviesToTest = [MockMovieProtocol(id: 1), MockMovieProtocol(id: 2)]
let expectation = XCTestExpectation(description: "Should get paging state")
// Act
viewModelToTest.viewState.bind { state in
Expand All @@ -72,7 +71,7 @@ final class SavedMoviesViewModelTests: XCTestCase {

func testGetCollectionListEmpty() {
// Arrange
let moviesToTest: [UpcomingMoviesDomain.Movie] = []
let moviesToTest: [MovieProtocol] = []
let expectation = XCTestExpectation(description: "Should get empty state")
// Act
viewModelToTest.viewState.bind { state in
Expand Down Expand Up @@ -102,7 +101,7 @@ final class SavedMoviesViewModelTests: XCTestCase {

func testMovieCellsCount() {
// Arrange
let moviesToTest = [Movie.with(id: 1), Movie.with(id: 2)]
let moviesToTest = [MockMovieProtocol(id: 1), MockMovieProtocol(id: 2)]
// Act
mockInteractor.getSavedMoviesResult = Result.success(moviesToTest)
viewModelToTest.getCollectionList()
Expand All @@ -113,7 +112,7 @@ final class SavedMoviesViewModelTests: XCTestCase {

func testMovieCellsZeroCount() {
// Arrange
let moviesToTest: [UpcomingMoviesDomain.Movie] = []
let moviesToTest: [MovieProtocol] = []
// Act
mockInteractor.getSavedMoviesResult = Result.success(moviesToTest)
viewModelToTest.getCollectionList()
Expand All @@ -124,7 +123,7 @@ final class SavedMoviesViewModelTests: XCTestCase {

func testMovieIndex() {
// Arrange
let moviesToTest = [Movie.with(id: 1), Movie.with(id: 2)]
let moviesToTest = [MockMovieProtocol(id: 1), MockMovieProtocol(id: 2)]
let indexToTest = Int.random(in: 0...moviesToTest.count - 1)
// Act
mockInteractor.getSavedMoviesResult = Result.success(moviesToTest)
Expand Down

0 comments on commit 71855f5

Please sign in to comment.