Skip to content

Commit 31db43c

Browse files
committed
add unitTests for string extensions
1 parent 17bc37a commit 31db43c

1 file changed

Lines changed: 12 additions & 20 deletions

File tree

AnimalsApp/AnimalsAppTests/ExtensionsTests/StringExtensionTests.swift

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,22 @@
66
//
77

88
import XCTest
9+
@testable import AnimalsApp
910

1011
class StringExtensionTests: XCTestCase {
1112

12-
override func setUpWithError() throws {
13-
// Put setup code here. This method is called before the invocation of each test method in the class.
13+
func testIfIsEmptyExtensionReturnsNil() {
14+
let emptyString = ""
15+
let result = emptyString.testIfIsEmpty()
16+
17+
XCTAssertNil(result)
1418
}
15-
16-
override func tearDownWithError() throws {
17-
// Put teardown code here. This method is called after the invocation of each test method in the class.
18-
}
19-
20-
func testExample() throws {
21-
// This is an example of a functional test case.
22-
// Use XCTAssert and related functions to verify your tests produce the correct results.
23-
// Any test you write for XCTest can be annotated as throws and async.
24-
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
25-
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
26-
}
27-
28-
func testPerformanceExample() throws {
29-
// This is an example of a performance test case.
30-
self.measure {
31-
// Put the code you want to measure the time of here.
32-
}
19+
20+
func testIfIsEmptyExtensionReturnsSelf() {
21+
let string = "string"
22+
let result = string.testIfIsEmpty()
23+
24+
XCTAssertEqual(string, result)
3325
}
3426

3527
}

0 commit comments

Comments
 (0)