@@ -11,9 +11,16 @@ import XCTest
1111final class CardImageParserTests : XCTestCase {
1212
1313 var sut : CardImageParser !
14+ var expirationDateFormatter : ExpirationDateFormatter !
15+
16+ override func setUpWithError( ) throws {
17+ try super. setUpWithError ( )
18+ expirationDateFormatter = ExpirationDateFormatter ( )
19+ }
1420
1521 override func tearDownWithError( ) throws {
1622 sut = nil
23+ expirationDateFormatter = nil
1724 try super. tearDownWithError ( )
1825 }
1926
@@ -35,7 +42,7 @@ final class CardImageParserTests: XCTestCase {
3542 }
3643
3744 // Then
38- waitForExpectations ( timeout: 10.0 )
45+ wait ( for : [ expectation ] , timeout: 0.1 )
3946 }
4047
4148 func testParseImageWithLowContrastCardImage( ) throws {
@@ -56,7 +63,7 @@ final class CardImageParserTests: XCTestCase {
5663 }
5764
5865 // Then
59- waitForExpectations ( timeout: 10.0 )
66+ wait ( for : [ expectation ] , timeout: 0.1 )
6067 }
6168
6269 func testParseImageWithInvalidLuhnCheck( ) throws {
@@ -78,7 +85,7 @@ final class CardImageParserTests: XCTestCase {
7885 }
7986
8087 // Then
81- waitForExpectations ( timeout: 10.0 )
88+ wait ( for : [ expectation ] , timeout: 0.1 )
8289 }
8390
8491 // MARK: - Private
@@ -145,9 +152,7 @@ final class CardImageParserTests: XCTestCase {
145152 )
146153 }
147154
148-
149155 private func dateFrom( _ string: String ) -> Date ? {
150- let dateFormatter = ExpirationDateFormatter ( )
151- return dateFormatter. date ( from: string)
156+ return expirationDateFormatter. date ( from: string)
152157 }
153158}
0 commit comments