Files
suixinkan_ios_new/suixinkanTests/TestFixture.swift
汉秋 a04168cf30 新增运营区域与飞手认证模块,并完善直播推流就绪流程
将运营区域与飞手认证从首页占位页迁移为完整模块,扩展 Live 播放与推流就绪流程,并新增飞手证书 OSS 上传。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 18:15:59 +08:00

69 lines
2.1 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// TestFixture.swift
// suixinkanTests
//
// Created by Codex on 2026/6/22.
//
import Foundation
@testable import suixinkan
/// Fixture JSON
enum TestFixture {
/// JSON fixture
static func data(named name: String, filePath: String = #filePath) throws -> Data {
var directory = URL(fileURLWithPath: filePath).deletingLastPathComponent()
while directory.path != "/" {
let url = directory
.appendingPathComponent("Fixtures")
.appendingPathComponent("\(name).json")
if FileManager.default.fileExists(atPath: url.path) {
return try Data(contentsOf: url)
}
directory.deleteLastPathComponent()
}
let fallback = URL(fileURLWithPath: filePath)
.deletingLastPathComponent()
.appendingPathComponent("Fixtures")
.appendingPathComponent("\(name).json")
return try Data(contentsOf: fallback)
}
/// Envelope
static func payload<T: Decodable>(_ type: T.Type, named name: String) throws -> T {
let envelope = try JSONDecoder().decode(APIEnvelope<T>.self, from: data(named: name))
guard let payload = envelope.data else {
throw FixtureError.emptyPayload
}
return payload
}
}
/// Fixture
enum FixtureError: Error {
case emptyPayload
}
extension OSSUploadServing {
/// Live
func uploadAliveAlbumFile(
data: Data,
fileName: String,
fileType: Int,
scenicId: Int,
onProgress: @escaping (Int) -> Void
) async throws -> String {
""
}
///
func uploadPilotCertificateImage(
data: Data,
fileName: String,
scenicId: Int,
onProgress: @escaping (Int) -> Void
) async throws -> String {
""
}
}