完善实名认证、钱包与打卡点模块 UI 与业务逻辑。
对齐 Android 实名认证流程与审核页、钱包提现/积分兑换界面,优化打卡点列表与详情交互,并补充相关资源、主题 token 与单元测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -62,4 +62,54 @@ final class ProfileModelsTests: XCTestCase {
|
||||
|
||||
XCTAssertTrue(info.verified)
|
||||
}
|
||||
|
||||
func testRealNameInfoDecodesCompleteAuditDetails() throws {
|
||||
let json = """
|
||||
{
|
||||
"real_name": "张三",
|
||||
"id_card_no": "11010519491231002X",
|
||||
"audit_status": "3",
|
||||
"audit_status_text": "审核驳回",
|
||||
"reject_reason": "国徽面照片模糊",
|
||||
"start_date": "2020-01-01",
|
||||
"end_date": "2030-01-01",
|
||||
"is_long_valid": "0",
|
||||
"front_url": "https://cdn.example.com/front.jpg",
|
||||
"back_url": "https://cdn.example.com/back.jpg",
|
||||
"auditor_id": "8",
|
||||
"auditor": { "id": "8", "name": "审核员" },
|
||||
"audit_at": "2026-07-13 12:00:00"
|
||||
}
|
||||
""".data(using: .utf8)!
|
||||
|
||||
let info = try JSONDecoder().decode(RealNameInfo.self, from: json)
|
||||
|
||||
XCTAssertEqual(info.auditStatus, 3)
|
||||
XCTAssertEqual(info.rejectReason, "国徽面照片模糊")
|
||||
XCTAssertEqual(info.frontUrl, "https://cdn.example.com/front.jpg")
|
||||
XCTAssertEqual(info.backUrl, "https://cdn.example.com/back.jpg")
|
||||
XCTAssertEqual(info.auditorId, 8)
|
||||
XCTAssertEqual(info.auditor?.name, "审核员")
|
||||
XCTAssertEqual(info.auditAt, "2026-07-13 12:00:00")
|
||||
}
|
||||
|
||||
func testRealNameInfoRemainsCompatibleWhenOptionalAuditFieldsAreMissing() throws {
|
||||
let json = """
|
||||
{
|
||||
"real_name": "李四",
|
||||
"id_card_no": "11010519491231002X",
|
||||
"audit_status": 1,
|
||||
"is_long_valid": 1
|
||||
}
|
||||
""".data(using: .utf8)!
|
||||
|
||||
let info = try JSONDecoder().decode(RealNameInfo.self, from: json)
|
||||
|
||||
XCTAssertEqual(info.auditStatus, 1)
|
||||
XCTAssertTrue(info.isLongValid)
|
||||
XCTAssertNil(info.rejectReason)
|
||||
XCTAssertNil(info.frontUrl)
|
||||
XCTAssertNil(info.auditor)
|
||||
XCTAssertNil(info.auditAt)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user