feat: 更新素材管理和举报风险地图
This commit is contained in:
@ -6,8 +6,8 @@
|
||||
import XCTest
|
||||
@testable import suixinkan
|
||||
|
||||
@MainActor
|
||||
/// 样片管理 API 测试。
|
||||
@MainActor
|
||||
final class SampleManagementAPITests: XCTestCase {
|
||||
func testListBuildsAndroidQuery() async throws {
|
||||
let session = MockURLSession(responses: [envelopeJSON(#"{"total":0,"list":[],"order":null}"#)])
|
||||
@ -26,6 +26,18 @@ final class SampleManagementAPITests: XCTestCase {
|
||||
XCTAssertEqual(query?.first { $0.name == "page_size" }?.value, "10")
|
||||
}
|
||||
|
||||
func testListDecodesNullableOrderAmounts() async throws {
|
||||
let session = MockURLSession(responses: [envelopeJSON(#"{"total":0,"list":[],"order":{"avg_change":-1025,"avg_order_amount":null,"refund_total":null,"total_num":0}}"#)])
|
||||
let api = SampleManagementAPI(client: APIClient(environment: .testing, session: session))
|
||||
|
||||
let response = try await api.list(status: 4, keyword: nil, page: 1, pageSize: 10)
|
||||
|
||||
XCTAssertEqual(response.order?.avgOrderAmount, "0")
|
||||
XCTAssertEqual(response.order?.refundTotal, "0")
|
||||
XCTAssertEqual(response.order?.avgChange, -1025)
|
||||
XCTAssertEqual(response.order?.totalNum, 0)
|
||||
}
|
||||
|
||||
func testDetailAndOperationUseSampleType() async throws {
|
||||
let detail = envelopeJSON(#"{"id":8,"status":1,"listing_status":1}"#)
|
||||
let empty = envelopeJSON("{}")
|
||||
|
||||
Reference in New Issue
Block a user