Fixing tests
This commit is contained in:
parent
49a7e88ee5
commit
371a2ebdb6
@ -8,13 +8,14 @@
|
||||
|
||||
import Testing
|
||||
import Mockable
|
||||
import AutoCatCore
|
||||
@testable import AutoCatCore
|
||||
import Foundation
|
||||
|
||||
struct VehicleRecordServiceTests {
|
||||
|
||||
let storageServiceMock = MockStorageServiceProtocol()
|
||||
let locationServiceMock: MockLocationServiceProtocol
|
||||
let audioRecordServiceMock = MockAudioRecordServiceProtocol()
|
||||
let settingsServiceMock = MockSettingsServiceProtocol()
|
||||
|
||||
let vehicleRecordService: VehicleRecordService
|
||||
init() async {
|
||||
@ -23,8 +24,8 @@ struct VehicleRecordServiceTests {
|
||||
|
||||
self.vehicleRecordService = .init(
|
||||
recordService: audioRecordServiceMock,
|
||||
storageService: storageServiceMock,
|
||||
locationService: locationServiceMock
|
||||
locationService: locationServiceMock,
|
||||
settingsService: settingsServiceMock
|
||||
)
|
||||
}
|
||||
|
||||
@ -50,5 +51,29 @@ struct VehicleRecordServiceTests {
|
||||
.called(.once)
|
||||
}
|
||||
|
||||
|
||||
@Test("Start recording")
|
||||
func startRecording() async throws {
|
||||
|
||||
given(audioRecordServiceMock)
|
||||
.startRecording(to: .any)
|
||||
.willReturn()
|
||||
|
||||
given(locationServiceMock)
|
||||
.getRecentLocation()
|
||||
.willReturn(.valid)
|
||||
|
||||
try await vehicleRecordService.startRecording()
|
||||
|
||||
verify(audioRecordServiceMock)
|
||||
.startRecording(to: .any)
|
||||
.called(.once)
|
||||
|
||||
verify(locationServiceMock)
|
||||
.getRecentLocation()
|
||||
.called(.once)
|
||||
|
||||
await #expect(vehicleRecordService.url != nil)
|
||||
await #expect(vehicleRecordService.location != nil)
|
||||
await #expect(vehicleRecordService.locationTask != nil)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user