damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

NdbExtensions.swift (646B)


      1 //
      2 //  NdbExtensions.swift
      3 //  damusTests
      4 //
      5 //  Created by Charlie Fish on 12/23/23.
      6 //
      7 
      8 import Foundation
      9 @testable import damus
     10 
     11 extension Ndb {
     12     static var test: Ndb {
     13         var tempDir: String!
     14         do {
     15             let fileManager = FileManager.default
     16             let temp = fileManager.temporaryDirectory.appendingPathComponent(UUID().uuidString)
     17             try fileManager.createDirectory(at: temp, withIntermediateDirectories: true, attributes: nil)
     18             tempDir = temp.absoluteString
     19         } catch {
     20             tempDir = "."
     21         }
     22 
     23         print("opening \(tempDir!)")
     24         return Ndb(path: tempDir)!
     25     }
     26 }