mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +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:
@@ -95,29 +95,3 @@ struct SessionDirectoriesTests {
|
||||
sessionDirectories.delete()
|
||||
}
|
||||
}
|
||||
|
||||
private 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