Skip to content

Commit 2d54710

Browse files
committed
Refactor unit tests for the UI module
1 parent d796faf commit 2d54710

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

Sources/ValidatorUI/Classes/IUIValidatable.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ValidatorCore
88

99
// MARK: - IUIValidatable
1010

11+
@MainActor
1112
public protocol IUIValidatable: AnyObject {
1213
associatedtype Input
1314

Tests/ValidatorUITests/UnitTests/UITextFieldTests.swift

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,13 @@ import XCTest
1313

1414
#if os(iOS)
1515
final class UITextFieldTests: XCTestCase {
16-
// MARK: Properties
17-
18-
private var textField: UITextField!
19-
20-
// MARK: XCTestCase
21-
22-
override func setUp() {
23-
super.setUp()
24-
textField = UITextField()
25-
}
26-
27-
override func tearDown() {
28-
textField = nil
29-
super.tearDown()
30-
}
31-
3216
// MARK: Tests
3317

18+
@MainActor
3419
func test_thatTextFieldValidationReturnsValid_whenInputValueIsValid() {
3520
// given
21+
let textField = UITextField()
22+
3623
textField.validateOnInputChange(isEnabled: true)
3724
textField.add(rule: LengthValidationRule(max: .max, error: String.error))
3825

@@ -49,8 +36,11 @@ import XCTest
4936
else { XCTFail("The result must be equal to the valid value") }
5037
}
5138

39+
@MainActor
5240
func test_thatTextFieldValidationReturnsInvalid_whenInputValueIsInvalid() {
5341
// given
42+
let textField = UITextField()
43+
5444
textField.validateOnInputChange(isEnabled: true)
5545
textField.add(rule: LengthValidationRule(max: .max, error: String.error))
5646

0 commit comments

Comments
 (0)