mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 20:39:24 +00:00
Add tests for the UserSessionStore. (#6065)
* Add enough mock configurations to test the UserSessionStore. * Add tests for the UserSessionStore.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Copyright 2025 Element Creations Ltd.
|
||||
// Copyright 2024-2025 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
@testable import ElementX
|
||||
import Foundation
|
||||
|
||||
extension SessionDirectories {
|
||||
var mockStateStorePath: String {
|
||||
dataDirectory.appending(component: "matrix-sdk-state.sqlite3").path(percentEncoded: false)
|
||||
}
|
||||
|
||||
var mockCryptoStorePath: String {
|
||||
dataDirectory.appending(component: "matrix-sdk-crypto.sqlite3").path(percentEncoded: false)
|
||||
}
|
||||
|
||||
var mockEventCachePath: String {
|
||||
cacheDirectory.appending(component: "matrix-sdk-event-cache.sqlite3").path(percentEncoded: false)
|
||||
}
|
||||
|
||||
func generateMockData() {
|
||||
generateMockDatabase(atPath: mockStateStorePath)
|
||||
generateMockDatabase(atPath: mockCryptoStorePath)
|
||||
generateMockDatabase(atPath: mockEventCachePath)
|
||||
}
|
||||
|
||||
private func generateMockDatabase(atPath path: String) {
|
||||
FileManager.default.createFile(atPath: path, contents: nil)
|
||||
FileManager.default.createFile(atPath: path + "-shm", contents: nil)
|
||||
FileManager.default.createFile(atPath: path + "-wal", contents: nil)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user