Skip to content

Commit d948ae7

Browse files
authored
Refactor FXIOS-12796 [Swift 6 Migration] Fix strict concurrency warnings in unit tests for Sync and some of Storage (#30991)
* Fix Sync target unit test strict concurrency errors. * Fix DiskImageStoreTests and RustLoginsTests in Storage target unit test strict concurrency errors.
1 parent a08e980 commit d948ae7

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

firefox-ios/firefox-ios-tests/Tests/StorageTests/DiskImageStoreTests.swift

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ import Shared
77
import UIKit
88
import XCTest
99

10+
@MainActor
1011
class DiskImageStoreTests: XCTestCase {
11-
var files: FileAccessor!
1212
var store: DiskImageStore!
1313

14-
override func setUp() {
15-
super.setUp()
16-
files = MockFiles()
17-
store = DefaultDiskImageStore(files: files, namespace: "DiskImageStoreTests", quality: 1)
14+
override func setUp() async throws {
15+
try await super.setUp()
16+
store = DefaultDiskImageStore(files: MockFiles(), namespace: "DiskImageStoreTests", quality: 1)
1817

19-
clearStore()
18+
await clearStore()
2019
}
2120

2221
func testSaveImageForKey() async throws {
@@ -56,12 +55,10 @@ class DiskImageStoreTests: XCTestCase {
5655
}
5756
}
5857

59-
// MARK: - Helper methods
58+
// MARK: - Helper methods
6059

61-
func clearStore() {
62-
Task {
63-
try? await store?.clearAllScreenshotsExcluding(Set())
64-
}
60+
func clearStore() async {
61+
try? await store?.clearAllScreenshotsExcluding(Set())
6562
}
6663

6764
func makeImageWithColor(_ color: UIColor, size: CGSize) -> UIImage {

firefox-ios/firefox-ios-tests/Tests/StorageTests/RustLoginsTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import XCTest
88

99
@testable import Storage
1010

11-
class RustLoginsTests: XCTestCase {
11+
// FIXME: FXIOS-14312 Class is not thread safe
12+
class RustLoginsTests: XCTestCase, @unchecked Sendable {
1213
var files: FileAccessor!
1314
var logins: RustLogins!
1415
let login = LoginEntry(fromJSONDict: [

firefox-ios/firefox-ios-tests/Tests/SyncTests/RustSyncManagerAPITests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ class RustSyncManagerAPITests: XCTestCase {
2727
expectation.fulfill()
2828
}
2929

30-
waitForExpectations(timeout: 5)
30+
wait(for: [expectation], timeout: 5)
3131
}
3232
}

0 commit comments

Comments
 (0)