Fixing tests
This commit is contained in:
parent
2481045a9c
commit
991af4a48f
@ -8,6 +8,7 @@
|
||||
|
||||
import Testing
|
||||
import CoreLocation
|
||||
import Mockable
|
||||
@testable import AutoCatCore
|
||||
|
||||
@MainActor
|
||||
@ -19,14 +20,19 @@ struct LocationServiceTests {
|
||||
|
||||
let geocoder = GeocoderMock()
|
||||
let locationManager = SwiftLocationMock()
|
||||
let settingsServiceMock = MockSettingsServiceProtocol()
|
||||
let locationService: LocationService
|
||||
|
||||
init() {
|
||||
|
||||
ServiceContainer.shared.register(GeocoderProtocol.self, instance: geocoder)
|
||||
ServiceContainer.shared.register(SwiftLocationProtocol.self, instance: locationManager)
|
||||
ServiceContainer.shared.register(SettingsServiceProtocol.self, instance: settingsServiceMock)
|
||||
|
||||
self.locationService = LocationService()
|
||||
|
||||
given(settingsServiceMock)
|
||||
.user.willReturn(User())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
import Testing
|
||||
import RealmSwift
|
||||
import Foundation
|
||||
import Mockable
|
||||
|
||||
@testable import AutoCatCore
|
||||
|
||||
@ -20,6 +21,7 @@ struct StorageServiceTests {
|
||||
let testLat: Double = 42
|
||||
let testLon: Double = 24
|
||||
|
||||
let settingsServiceMock = MockSettingsServiceProtocol()
|
||||
let storageService: StorageService
|
||||
|
||||
init() async throws {
|
||||
@ -27,9 +29,14 @@ struct StorageServiceTests {
|
||||
var config: Realm.Configuration = .defaultConfiguration
|
||||
config.inMemoryIdentifier = UUID().uuidString
|
||||
|
||||
await ServiceContainer.shared.register(SettingsServiceProtocol.self, instance: settingsServiceMock)
|
||||
|
||||
self.storageService = try await StorageService(config: config)
|
||||
|
||||
try addTestVehicle(config: config)
|
||||
|
||||
given(settingsServiceMock)
|
||||
.user.willReturn(User())
|
||||
}
|
||||
|
||||
func addTestVehicle(config: Realm.Configuration) throws {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user