Fix migrateJSON declarations and exposure

Unit tests could not compile.
This commit is contained in:
Davide De Rosa 2018-11-01 23:55:44 +01:00
parent a38f5d3070
commit af870e2a84
2 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ import SwiftyBeaver
private let log = SwiftyBeaver.self private let log = SwiftyBeaver.self
extension ConnectionService { extension ConnectionService {
static func migrateJSON(at from: URL, to: URL) { static func migrateJSON(from: URL, to: URL) {
do { do {
let newData = try migrateJSON(at: from) let newData = try migrateJSON(at: from)
// log.verbose(String(data: newData, encoding: .utf8)!) // log.verbose(String(data: newData, encoding: .utf8)!)
@ -39,8 +39,8 @@ extension ConnectionService {
} }
} }
private static func migrateJSON(at from: URL) throws -> Data { static func migrateJSON(at url: URL) throws -> Data {
let data = try Data(contentsOf: from) let data = try Data(contentsOf: url)
guard var json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { guard var json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else {
throw ApplicationError.migration throw ApplicationError.migration
} }

View File

@ -53,7 +53,7 @@ class TransientStore {
private init() { private init() {
let cfg = AppConstants.VPN.baseConfiguration() let cfg = AppConstants.VPN.baseConfiguration()
do { do {
ConnectionService.migrateJSON(at: TransientStore.serviceURL, to: TransientStore.serviceURL) ConnectionService.migrateJSON(from: TransientStore.serviceURL, to: TransientStore.serviceURL)
let data = try Data(contentsOf: TransientStore.serviceURL) let data = try Data(contentsOf: TransientStore.serviceURL)
if let content = String(data: data, encoding: .utf8) { if let content = String(data: data, encoding: .utf8) {