Add tests for the UserSessionStore. (#6065)

* Add enough mock configurations to test the UserSessionStore.

* Add tests for the UserSessionStore.
This commit is contained in:
Doug
2026-08-25 16:41:43 +01:00
committed by GitHub
parent 353233672a
commit c8b12d9496
15 changed files with 468 additions and 27 deletions
@@ -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)
}
}