21 lines
525 B
Swift
21 lines
525 B
Swift
//
|
|
// Fixtures.swift
|
|
// MeowTests
|
|
//
|
|
|
|
import Foundation
|
|
|
|
final class Fixtures {
|
|
static let facts: Data = loadFixture("facts")
|
|
|
|
private static func loadFixture(_ name: String) -> Data {
|
|
guard let url = Bundle.module.url(forResource: name, withExtension: "json") else {
|
|
fatalError("Failed to load fixture: \(name).json")
|
|
}
|
|
guard let data = try? Data(contentsOf: url) else {
|
|
fatalError("Unable to get Data from contents of \(url)")
|
|
}
|
|
return data
|
|
}
|
|
}
|