Skip to content

Commit 0a8063d

Browse files
committed
test: MOCKArrInfo 프로퍼티 선언
1 parent aefeffb commit 0a8063d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

BBus/AlarmSettingViewModelTests/AlarmSettingViewModelTests.swift

+13-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AlarmSettingViewModelTests: XCTestCase {
1414
}
1515

1616
enum TestError: Error {
17-
case fail
17+
case fail, jsonError
1818
}
1919

2020
class MOCKSearchAPIUseCase: AlarmSettingAPIUsable {
@@ -34,14 +34,26 @@ class AlarmSettingViewModelTests: XCTestCase {
3434
}
3535

3636
private var cancellables: Set<AnyCancellable>!
37+
private var arrInfoByRouteDTO: ArrInfoByRouteDTO!
3738

3839
override func setUpWithError() throws {
40+
guard let url = Bundle.init(identifier: "com.boostcamp.ios-009.AlarmSettingViewModelTests")?
41+
.url(forResource: "MOCKArrInfo", withExtension: "json"),
42+
let data = try? Data(contentsOf: url),
43+
let arrInfoByRouteDTO = try? JSONDecoder().decode(ArrInfoByRouteDTO.self, from: data) else { throw TestError.jsonError }
44+
3945
self.cancellables = []
46+
self.arrInfoByRouteDTO = arrInfoByRouteDTO
4047
super.setUp()
4148
}
4249

4350
override func tearDownWithError() throws {
4451
self.cancellables = nil
52+
self.arrInfoByRouteDTO = nil
4553
super.tearDown()
4654
}
55+
56+
func test_bindBusArriveInfo_성공() {
57+
58+
}
4759
}

0 commit comments

Comments
 (0)