Skip to content

Commit 174bd7e

Browse files
PanchamiShenoympospese
authored andcommitted
[CM-900] Organized test files
1 parent a8c2da4 commit 174bd7e

File tree

11 files changed

+149
-114
lines changed

11 files changed

+149
-114
lines changed
File renamed without changes.
File renamed without changes.

Tests/YComponentBrowserTests/CatalogCategoryTest.swift

Lines changed: 0 additions & 114 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// ClassificationDataSourceTests.swift
3+
//
4+
// Created by Panchami Shenoy on 06/10/22.
5+
//
6+
7+
import XCTest
8+
@testable import YComponentBrowser
9+
10+
final class ClassificationDataSourceTests: XCTestCase {
11+
var controller = UIViewController()
12+
13+
func testClassificationDataSource() {
14+
let tableview = UITableView()
15+
let classificationDataSource = ClassificationDataSource(
16+
navigationTitle: "title",
17+
classification: [
18+
Demo(
19+
destination: Demodestination(
20+
present: .detail,
21+
title: "color",
22+
controller: controller
23+
)
24+
)
25+
]
26+
)
27+
XCTAssertEqual(
28+
1,
29+
classificationDataSource.tableView(
30+
UITableView(),
31+
numberOfRowsInSection: classificationDataSource.categories.count
32+
)
33+
)
34+
35+
tableview.register(
36+
ClassificationDataSource.cell,
37+
forCellReuseIdentifier: ClassificationDataSource.cellIdentifier
38+
)
39+
let tableCell = classificationDataSource.tableView(tableview, cellForRowAt: [0, 0])
40+
XCTAssertNotNil(tableCell)
41+
}
42+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// catalogCategoryTest.swift
3+
//
4+
// Created by Y Media Labs on 08/09/22.
5+
//
6+
import XCTest
7+
@testable import YComponentBrowser
8+
9+
final class CatalogCategoryTest: XCTestCase {
10+
var controller = UIViewController()
11+
func testCatalogCategory() {
12+
let category = CatalogCategory(
13+
name: "category",
14+
subcategories:
15+
[
16+
Demo(
17+
destination: Demodestination(
18+
present: .detail,
19+
title: "color",
20+
controller: controller
21+
)
22+
)
23+
]
24+
)
25+
XCTAssertEqual("category", category.destination.navigationTitle)
26+
XCTAssertEqual(.detail, category.destination.presentationStyle)
27+
}
28+
}
29+
30+
class Demo: Classification {
31+
var name: String = ""
32+
var destination: Destination
33+
public init(destination: Destination) {
34+
self.destination = destination
35+
}
36+
}
37+
38+
class Demodestination: Destination {
39+
func getDestinationController() -> UIViewController {
40+
return controller
41+
}
42+
43+
var presentationStyle: Presentation
44+
var navigationTitle: String?
45+
var controller: UIViewController
46+
public init(present: Presentation, title: String, controller: UIViewController) {
47+
presentationStyle = present
48+
navigationTitle = title
49+
self.controller = controller
50+
}
51+
}
File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// CatalogDestinationTests.swift
3+
//
4+
// Created by Panchami Shenoy on 06/10/22.
5+
//
6+
7+
import XCTest
8+
@testable import YComponentBrowser
9+
10+
final class CatalogDestinationTests: XCTestCase {
11+
func testCatalogDestination() {
12+
let catalogDestination = CatalogDetailDestination<DemoView>(
13+
presentationStyle: .detail,
14+
navigationTitle: "title",
15+
models: [DemoModel()]
16+
)
17+
XCTAssertEqual(.detail, catalogDestination.presentationStyle)
18+
XCTAssertNotNil(catalogDestination.getDestinationController())
19+
}
20+
}

0 commit comments

Comments
 (0)