Skip to content

Commit

Permalink
make it pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaskollmer committed Jan 28, 2025
1 parent e5d0505 commit 8886d5e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Sources/SpeziLocalStorage/LocalStorageKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ extension LocalStorageKey {
/// Creates a Local Storage Key that uses a custom encoder and decoder.
public convenience init<E: TopLevelEncoder & Sendable, D: TopLevelDecoder & Sendable>(
_ key: String,
setting: LocalStorageSetting = .default,
setting: LocalStorageSetting = .default, // swiftlint:disable:this function_default_parameter_at_end
encoder: E,
decoder: D
) where Value: Codable, E.Output == Data, D.Input == Data {
Expand Down
29 changes: 22 additions & 7 deletions Tests/SpeziLocalStorageTests/LocalStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ private struct Letter: Codable, Equatable {
}


private extension LocalStorageKeys {
static let letter = LocalStorageKey<Letter>("letter", setting: .unencrypted())
extension LocalStorageKeys { // swiftlint:disable:this file_types_order
fileprivate static let letter = LocalStorageKey<Letter>("letter", setting: .unencrypted())
}


Expand Down Expand Up @@ -92,21 +92,36 @@ final class LocalStorageTests: XCTestCase {
let letter = Letter(greeting: "Hello Lukas 😳😳😳")

try localStorage.store(letter, for: keyNoBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(localStorage.fileURL(for: keyNoBackup), shouldBeExcluded: keyNoBackup.setting.isExcludedFromBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(
localStorage.fileURL(for: keyNoBackup),
shouldBeExcluded: keyNoBackup.setting.isExcludedFromBackup
)

try localStorage.store(letter, for: keyYesBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(localStorage.fileURL(for: keyYesBackup), shouldBeExcluded: keyYesBackup.setting.isExcludedFromBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(
localStorage.fileURL(for: keyYesBackup),
shouldBeExcluded: keyYesBackup.setting.isExcludedFromBackup
)

try localStorage.deleteAll()

try localStorage.store(letter, for: keyYesBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(localStorage.fileURL(for: keyYesBackup), shouldBeExcluded: keyYesBackup.setting.isExcludedFromBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(
localStorage.fileURL(for: keyYesBackup),
shouldBeExcluded: keyYesBackup.setting.isExcludedFromBackup
)

try localStorage.store(letter, for: keyNoBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(localStorage.fileURL(for: keyNoBackup), shouldBeExcluded: keyNoBackup.setting.isExcludedFromBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(
localStorage.fileURL(for: keyNoBackup),
shouldBeExcluded: keyNoBackup.setting.isExcludedFromBackup
)

try localStorage.store(letter, for: keyYesBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(localStorage.fileURL(for: keyYesBackup), shouldBeExcluded: keyYesBackup.setting.isExcludedFromBackup)
try assertItemAtUrlIsExcludedFromBackupEquals(
localStorage.fileURL(for: keyYesBackup),
shouldBeExcluded: keyYesBackup.setting.isExcludedFromBackup
)
}


Expand Down
1 change: 1 addition & 0 deletions Tests/UITests/TestApp/TestApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Spezi
import SwiftUI
import XCTestApp


@main
struct UITestsApp: App {
@ApplicationDelegateAdaptor(TestAppDelegate.self) var appDelegate
Expand Down

0 comments on commit 8886d5e

Please sign in to comment.