Skip to content
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
2 changes: 2 additions & 0 deletions ICTMDBHomeModule/HomePresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ extension HomePresenter: ViewToPresenterHomeProtocol {

func viewDidLoad() {
view?.setBackColorAble(color: "backColor")
//TODO: move to Localizable
view?.setNavigationTitle(title: "Home Page")
interactor.loadPopularMovies()
interactor.loadAiringMovies()
}
Expand Down
2 changes: 1 addition & 1 deletion ICTMDBHomeModule/HomeProtocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import UIKit

// MARK: - Typealias
/// Combines UIViewAble and SegueAble protocols for convenience.
typealias Ables = UIViewAble & SegueAble
typealias Ables = UIViewAble & SegueAble & NavConUIAble

// MARK: - View → Presenter
/// Protocol for communication from View to Presenter.
Expand Down
2 changes: 1 addition & 1 deletion ICTMDBHomeModule/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@ extension HomeViewController: @MainActor PresenterToViewHomeProtocol {
// MARK: - Preview
#Preview {
let module = ICTMDBHomeModule()
module.createHomeModule()
UINavigationController(rootViewController: module.createHomeModule())
}
14 changes: 14 additions & 0 deletions ICTMDBHomeModuleTests/ICTMDBHomeModuleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ struct ICTMDBHomeModuleTests {
#expect(view.invokedSetBackColorAbleData == ["backColor"])
}


@Test("Set navigaiton title")
func testNavigationTitle() {
#expect(view.invokedSetNavigationTitle == false)
#expect(view.invokedSetNavigationTitleCount == 0)

presenter.viewDidLoad()

#expect(view.invokedSetNavigationTitle == true)
#expect(view.invokedSetNavigationTitleCount == 1)
#expect(view.invokedSetNavigationTitleData.map(\.title) == ["Home Page"])

}

@Test("Check number of sections")
func testNumberOfSections() {
presenter.viewDidLoad()
Expand Down
12 changes: 12 additions & 0 deletions ICTMDBHomeModuleTests/MockHomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import UIKit
@testable import ICTMDBHomeModule

final class MockHomeViewController: PresenterToViewHomeProtocol {


// MARK: - Mock Functions

Expand All @@ -19,6 +20,17 @@ final class MockHomeViewController: PresenterToViewHomeProtocol {
invokedRelaodCollectionView = true
invokedRelaodCollectionViewCount += 1
}

var invokedSetNavigationTitle = false
var invokedSetNavigationTitleCount = 0
var invokedSetNavigationTitleData: [(title: String,())] = []
func setNavigationTitle(title: String) {
invokedSetNavigationTitle = true
invokedSetNavigationTitleCount += 1
invokedSetNavigationTitleData.append((title: title, ()))

}


var invokedSendError = false
var invokedSendErrorCount = 0
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/SnapKit/SnapKit.git", from: "5.0.1"),
.package(url: "https://github.com/engingulek/GenericCollectionViewKit",from:"0.0.1"),
.package(url: "https://github.com/engingulek/GenericCollectionViewKit",from:"0.0.2"),
.package(url: "https://github.com/engingulek/ICTMDBModularProtocols", from: "0.0.1"),
.package(url: "https://github.com/engingulek/ICTMDBNetworkManagerKit", from: "0.0.1"),
.package(url: "https://github.com/engingulek/ICTMDBViewKit", from: "0.0.1"),
.package(url: "https://github.com/engingulek/ICTMDBNetworkManagerKit", from: "0.0.2"),
.package(url: "https://github.com/engingulek/ICTMDBViewKit", from: "0.0.3"),
.package(url: "https://github.com/engingulek/HPDependencyKit", from: "1.0.0"),
],
targets: [
Expand Down