Repository Public
1//2// Fabri-Ka iOS v23// File: FabriKaTests/Support.swift4// Description: lecture des réponses réelles de l'API (échantillons de la révision 3, 2026-11-26).5//6// Author: Simon-Pierre Boucher7// Contact: contact@spboucher.ai8//910import Foundation11import XCTest12@testable import FabriKa1314enum Fixture {15 static func data(_ name: String, file: StaticString = #filePath, line: UInt = #line) throws -> Data {16 let bundle = Bundle(for: DecodingTests.self)17 let url = try XCTUnwrap(bundle.url(forResource: name, withExtension: "json"), "échantillon \(name).json absent", file: file, line: line)18 return try Data(contentsOf: url)19 }2021 static func decode<T: Decodable>(_ name: String, as type: T.Type = T.self, file: StaticString = #filePath, line: UInt = #line) throws -> T {22 try JSONDecoder().decode(T.self, from: data(name, file: file, line: line))23 }24}25