新增门店订单与核销管理列表,对齐 Android 订单能力并完善账号级缓存。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -171,6 +171,35 @@ final class ProfileSecondaryPagesTests: XCTestCase {
|
||||
XCTAssertFalse(RealNameAuthViewModel.isValidMainlandIDCardNumber("123"))
|
||||
}
|
||||
|
||||
/// 测试接口返回前使用本地缓存展示昵称、手机号和头像。
|
||||
func testProfileDisplayFieldsUseCachedProfileBeforeUserInfoLoads() {
|
||||
let viewModel = ProfileViewModel()
|
||||
viewModel.applyCachedProfile(
|
||||
AccountProfile(
|
||||
userId: "101",
|
||||
displayName: "缓存昵称",
|
||||
phone: "13800000000",
|
||||
avatarURL: "https://cdn.example.com/avatar.jpg"
|
||||
)
|
||||
)
|
||||
|
||||
XCTAssertEqual(viewModel.displayNickname, "缓存昵称")
|
||||
XCTAssertEqual(viewModel.displayPhone, "13800000000")
|
||||
XCTAssertEqual(viewModel.displayAvatarURL, "https://cdn.example.com/avatar.jpg")
|
||||
}
|
||||
|
||||
/// 测试接口数据已存在时不再被本地缓存覆盖。
|
||||
func testApplyCachedProfileIgnoredAfterUserInfoLoaded() {
|
||||
let viewModel = ProfileViewModel()
|
||||
viewModel.userInfo = UserInfoResponse(nickname: "接口昵称", phone: "13900000000")
|
||||
viewModel.applyCachedProfile(
|
||||
AccountProfile(userId: "101", displayName: "缓存昵称", phone: "13800000000")
|
||||
)
|
||||
|
||||
XCTAssertEqual(viewModel.displayNickname, "接口昵称")
|
||||
XCTAssertEqual(viewModel.displayPhone, "13900000000")
|
||||
}
|
||||
|
||||
/// 测试头像变更时先上传 OSS,再回写头像 URL。
|
||||
func testProfileAvatarUploadUpdatesAvatarURL() async throws {
|
||||
let session = ProfileSecondaryURLSession(responses: [
|
||||
|
||||
Reference in New Issue
Block a user