Skip to content

Commit

Permalink
Rename CouchTrackerSyncTests.swift to Helpers.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
Pietro Caselani committed Jan 1, 2020
1 parent c9b7297 commit 72f6600
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 47 deletions.
47 changes: 0 additions & 47 deletions CouchTrackerSyncTests/CouchTrackerSyncTests.swift

This file was deleted.

13 changes: 13 additions & 0 deletions CouchTrackerSyncTests/Helpers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Foundation

private final class TestableClass: NSObject {}

private let bundle = Bundle(for: TestableClass.self)

func read(file named: String) -> Data {
return bundle.url(forResource: named, withExtension: "json").map { try! Data(contentsOf: $0) }!
}

func decode<T: Codable>(file name: String, as type: T.Type) -> T {
return try! JSONDecoder().decode(type, from: read(file: name))
}

0 comments on commit 72f6600

Please sign in to comment.