Signal-iOS/SignalServiceKit/tests/Storage/Database/GRDBDatabaseStorageAdapterTest.swift
Evan Hahn 349681ff85
Attempt to recover corrupted databases
If a user's database is corrupted, we now try to fix it. I recommend
reviewing `DatabaseRecovery` to see how this works, and
`DatabaseRecoveryViewController` for the bulk of the UI.
2022-10-06 16:42:19 -05:00

23 lines
716 B
Swift

//
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import XCTest
import SignalServiceKit
final class GRDBDatabaseStorageAdapterTest: XCTestCase {
func testWalFileUrl() throws {
let input = URL(fileURLWithPath: "/tmp/foo.db")
let expected = URL(fileURLWithPath: "/tmp/foo.db-wal")
let actual = GRDBDatabaseStorageAdapter.walFileUrl(for: input)
XCTAssertEqual(actual, expected)
}
func testShmFileUrl() throws {
let input = URL(fileURLWithPath: "/tmp/foo.db")
let expected = URL(fileURLWithPath: "/tmp/foo.db-shm")
let actual = GRDBDatabaseStorageAdapter.shmFileUrl(for: input)
XCTAssertEqual(actual, expected)
}
}