Skip to content

Commit 8142e9e

Browse files
committed
test
1 parent 6c86bef commit 8142e9e

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

ICTMDBHomeModule/HomeViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,5 @@ extension HomeViewController: @MainActor PresenterToViewHomeProtocol {
135135
// MARK: - Preview
136136
#Preview {
137137
let module = ICTMDBHomeModule()
138-
module.createHomeModule()
138+
UINavigationController(rootViewController: module.createHomeModule())
139139
}

ICTMDBHomeModuleTests/ICTMDBHomeModuleTests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ struct ICTMDBHomeModuleTests {
4242
#expect(view.invokedSetBackColorAbleData == ["backColor"])
4343
}
4444

45+
46+
@Test("Set navigaiton title")
47+
func testNavigationTitle() {
48+
#expect(view.invokedSetNavigationTitle == false)
49+
#expect(view.invokedSetNavigationTitleCount == 0)
50+
51+
presenter.viewDidLoad()
52+
53+
#expect(view.invokedSetNavigationTitle == true)
54+
#expect(view.invokedSetNavigationTitleCount == 1)
55+
#expect(view.invokedSetNavigationTitleData.map(\.title) == ["Home Page"])
56+
57+
}
58+
4559
@Test("Check number of sections")
4660
func testNumberOfSections() {
4761
presenter.viewDidLoad()

ICTMDBHomeModuleTests/MockHomeViewController.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import UIKit
1010
@testable import ICTMDBHomeModule
1111

1212
final class MockHomeViewController: PresenterToViewHomeProtocol {
13+
1314

1415
// MARK: - Mock Functions
1516

@@ -19,6 +20,17 @@ final class MockHomeViewController: PresenterToViewHomeProtocol {
1920
invokedRelaodCollectionView = true
2021
invokedRelaodCollectionViewCount += 1
2122
}
23+
24+
var invokedSetNavigationTitle = false
25+
var invokedSetNavigationTitleCount = 0
26+
var invokedSetNavigationTitleData: [(title: String,())] = []
27+
func setNavigationTitle(title: String) {
28+
invokedSetNavigationTitle = true
29+
invokedSetNavigationTitleCount += 1
30+
invokedSetNavigationTitleData.append((title: title, ()))
31+
32+
}
33+
2234

2335
var invokedSendError = false
2436
var invokedSendErrorCount = 0

0 commit comments

Comments
 (0)