Implement profile tab with Android-aligned flows and OSS upload.
Add personal info page, account switch, real-name auth, withdrawal settings, session cache extensions, AlibabaCloudOSS SPM, and unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
58
suixinkanTests/WithdrawalSettingsViewModelTests.swift
Normal file
58
suixinkanTests/WithdrawalSettingsViewModelTests.swift
Normal file
@ -0,0 +1,58 @@
|
||||
//
|
||||
// WithdrawalSettingsViewModelTests.swift
|
||||
// suixinkanTests
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import XCTest
|
||||
@testable import suixinkan
|
||||
|
||||
/// 提现设置 ViewModel 测试。
|
||||
final class WithdrawalSettingsViewModelTests: XCTestCase {
|
||||
func testCanGoNextStepRequiresImagesAndAgreement() {
|
||||
let viewModel = WithdrawalSettingsViewModel()
|
||||
viewModel.updateHolderName("张三")
|
||||
viewModel.updateBankNo("6222021234567890")
|
||||
viewModel.updateAgree(true)
|
||||
|
||||
XCTAssertFalse(viewModel.canGoNextStep)
|
||||
|
||||
try? viewModel.prepareBankCardImage(
|
||||
data: UIImage(systemName: "photo")!.pngData()!,
|
||||
side: .front
|
||||
)
|
||||
try? viewModel.prepareBankCardImage(
|
||||
data: UIImage(systemName: "photo")!.pngData()!,
|
||||
side: .back
|
||||
)
|
||||
|
||||
XCTAssertTrue(viewModel.canGoNextStep)
|
||||
}
|
||||
|
||||
func testCanSubmitRequiresStepTwoFields() throws {
|
||||
let viewModel = WithdrawalSettingsViewModel()
|
||||
viewModel.updateHolderName("张三")
|
||||
viewModel.updateBankNo("6222021234567890")
|
||||
viewModel.updateAgree(true)
|
||||
try viewModel.prepareBankCardImage(
|
||||
data: XCTUnwrap(UIImage(systemName: "photo")?.pngData()),
|
||||
side: .front
|
||||
)
|
||||
try viewModel.prepareBankCardImage(
|
||||
data: XCTUnwrap(UIImage(systemName: "photo")?.pngData()),
|
||||
side: .back
|
||||
)
|
||||
viewModel.goNextStep()
|
||||
|
||||
viewModel.updateBankName("中国银行")
|
||||
viewModel.updateBranchName("南京支行")
|
||||
viewModel.updateVerificationCode("123456")
|
||||
|
||||
XCTAssertFalse(viewModel.canSubmit)
|
||||
|
||||
viewModel.selectProvince(AreasResponse(id: 1, code: "32", name: "江苏", children: []))
|
||||
viewModel.selectCity(AreasResponse(id: 2, code: "3201", name: "南京", children: []))
|
||||
|
||||
XCTAssertTrue(viewModel.canSubmit)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user