Skip to content

Commit

Permalink
PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
buggmagnet committed Oct 26, 2023
1 parent 77fa681 commit e0aff91
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ios/MullvadVPNTests/MigrationManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,40 @@ final class MigrationManagerTests: XCTestCase {
let settings = TunnelSettingsV3()
try SettingsManager.writeSettings(settings)

let nothingToMigrationExpectation = expectation(description: "No migration")
let nothingToMigrateExpectation = expectation(description: "No migration")
manager.migrateSettings(store: store, proxyFactory: proxyFactory) { result in
if case .nothing = result {
nothingToMigrationExpectation.fulfill()
nothingToMigrateExpectation.fulfill()
}
}
wait(for: [nothingToMigrationExpectation], timeout: 1)
wait(for: [nothingToMigrateExpectation], timeout: 1)
}

func testNothingToMigrateIfRecordedSettingsVersionHigherThanLatestSettings() throws {
let store = Self.store
let settings = FutureVersionSettings()
try write(settings: settings, version: Int.max - 1, in: store)

let nothingToMigrationExpectation = expectation(description: "No migration")
let nothingToMigrateExpectation = expectation(description: "No migration")
manager.migrateSettings(store: store, proxyFactory: proxyFactory) { result in
if case .nothing = result {
nothingToMigrationExpectation.fulfill()
nothingToMigrateExpectation.fulfill()
}
}
wait(for: [nothingToMigrationExpectation], timeout: 1)
wait(for: [nothingToMigrateExpectation], timeout: 1)
}

func testNothingToMigrateWhenSettingsAreNotFound() throws {
let store = InMemorySettingsStore<KeychainError>()
SettingsManager.unitTestStore = store

let nothingToMigrationExpectation = expectation(description: "No migration")
let nothingToMigrateExpectation = expectation(description: "No migration")
manager.migrateSettings(store: store, proxyFactory: proxyFactory) { result in
if case .nothing = result {
nothingToMigrationExpectation.fulfill()
nothingToMigrateExpectation.fulfill()
}
}
wait(for: [nothingToMigrationExpectation], timeout: 1)
wait(for: [nothingToMigrateExpectation], timeout: 1)

// Reset the `SettingsManager` unit test store to avoid affecting other tests
// since it's a globally shared instance
Expand Down

0 comments on commit e0aff91

Please sign in to comment.