new app store assets ready for relese ui updates
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import Foundation
|
||||
|
||||
@main struct LogTests {
|
||||
@MainActor static func main() throws {
|
||||
let root = URL(fileURLWithPath: ProcessInfo.processInfo.environment["TARNAX_SCRATCH_ROOT"]!).appendingPathComponent("log-tests-" + UUID().uuidString)
|
||||
defer { try? FileManager.default.removeItem(at: root) }
|
||||
let url = root.appendingPathComponent("activity.json")
|
||||
let first = AppLogStore(url: url)
|
||||
precondition(first.entries.isEmpty)
|
||||
let time = Date()
|
||||
first.record("Connected.", at: time)
|
||||
first.record("Connected.", at: time.addingTimeInterval(1))
|
||||
precondition(first.entries.count == 1 && first.entries[0].count == 2)
|
||||
let restored = AppLogStore(url: url)
|
||||
precondition(restored.entries.count == 1 && restored.entries[0].count == 2)
|
||||
let privateURL = URL(string: "https://user:secret@example.test/private?token=secret")!
|
||||
restored.failure(URLError(.timedOut, userInfo: [NSURLErrorFailingURLErrorKey: privateURL]), context: "Server request")
|
||||
let archive = try String(contentsOf: url, encoding: .utf8)
|
||||
precondition(!archive.contains("secret") && !archive.contains("example.test"))
|
||||
for index in 0...1000 { restored.record("Event \(index)") }
|
||||
precondition(restored.entries.count == AppLogStore.capacity)
|
||||
precondition(AppLogStore(url: url).entries.count == AppLogStore.capacity)
|
||||
restored.clear()
|
||||
precondition(restored.entries.isEmpty && !FileManager.default.fileExists(atPath: url.path))
|
||||
precondition(AppLogStore(url: url).entries.isEmpty)
|
||||
let blocker = root.appendingPathComponent("blocked")
|
||||
try Data("blocked".utf8).write(to: blocker)
|
||||
let failed = AppLogStore(url: blocker.appendingPathComponent("log.json"))
|
||||
failed.record("Cannot save.")
|
||||
precondition(failed.storageError != nil)
|
||||
print("Log persistence, grouping, capacity, privacy, clear/reload and storage failure checks passed.")
|
||||
}
|
||||
}
|
||||
@@ -6,3 +6,6 @@ BUILD_DIR="$(mktemp -d "$TARNAX_SCRATCH_ROOT/contracts.XXXXXX")"
|
||||
trap 'rm -rf "$BUILD_DIR"' EXIT
|
||||
xcrun swiftc -parse-as-library -module-cache-path "$BUILD_DIR/cache" Tarnax/Core.swift Tests/ContractTests.swift -o "$BUILD_DIR/ContractTests"
|
||||
"$BUILD_DIR/ContractTests"
|
||||
|
||||
xcrun swiftc -parse-as-library -module-cache-path "$BUILD_DIR/cache" Tarnax/Core.swift Tests/LogTests.swift -o "$BUILD_DIR/LogTests"
|
||||
"$BUILD_DIR/LogTests"
|
||||
|
||||
Reference in New Issue
Block a user