Created
July 24, 2021 04:55
-
-
Save ykpoh/24f9f6f66889d4e38d99a7f8e80224c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import XCTest | |
protocol DecodableTestCase: class { | |
associatedtype T: Decodable | |
var sut: T! { get set } | |
} | |
extension DecodableTestCase { | |
func givenSUTFromJSON(fileName: String = "\(T.self)") throws { | |
let decoder = JSONDecoder() | |
let data = try Data.fromJSON(fileName: fileName) | |
sut = try decoder.decode(T.self, from: data) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment