模块化 AppStore 并完善素材管理与个人空间设置。
将会话、权限、位置、收款与排队存储拆分为独立模块,同步更新各 ViewModel 与单元测试,并补充素材管理 UI 与个人空间设置交互。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -15,10 +15,10 @@ final class ProfileViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testShowPhotographerFieldsWhenRoleCodeIsPhotographer() {
|
||||
AppStore.shared.roleCode = AppRoleCode.photographer.rawValue
|
||||
AppStore.shared.session.roleCode = AppRoleCode.photographer.rawValue
|
||||
let viewModel = ProfileViewModel()
|
||||
XCTAssertTrue(viewModel.showPhotographerFields)
|
||||
AppStore.shared.roleCode = ""
|
||||
AppStore.shared.session.roleCode = ""
|
||||
}
|
||||
|
||||
func testMaskCardNumberShowsLastFourDigits() {
|
||||
@ -45,24 +45,24 @@ final class ProfileViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testAccountTypeLabelForStoreAccount() {
|
||||
AppStore.shared.accountType = V9StoreUser.accountTypeValue
|
||||
AppStore.shared.session.accountType = .storeUser
|
||||
let viewModel = ProfileViewModel()
|
||||
XCTAssertEqual(viewModel.accountTypeLabel, "门店账号")
|
||||
XCTAssertTrue(viewModel.isStoreAccount)
|
||||
AppStore.shared.accountType = ""
|
||||
AppStore.shared.session.accountType = .unknown("")
|
||||
}
|
||||
|
||||
func testAccountTypeLabelForScenicAccount() {
|
||||
AppStore.shared.accountType = V9ScenicUser.accountTypeValue
|
||||
AppStore.shared.session.accountType = .scenicUser
|
||||
let viewModel = ProfileViewModel()
|
||||
XCTAssertEqual(viewModel.accountTypeLabel, "景区账号")
|
||||
XCTAssertFalse(viewModel.isStoreAccount)
|
||||
AppStore.shared.accountType = ""
|
||||
AppStore.shared.session.accountType = .unknown("")
|
||||
}
|
||||
|
||||
func testApplyLocalProfileUpdateSyncsNicknameAndAvatar() {
|
||||
AppStore.shared.userName = "全局昵称"
|
||||
AppStore.shared.avatar = "https://cdn.example.com/new.jpg"
|
||||
AppStore.shared.session.userName = "全局昵称"
|
||||
AppStore.shared.session.avatar = "https://cdn.example.com/new.jpg"
|
||||
|
||||
let viewModel = ProfileViewModel()
|
||||
viewModel.applyLocalProfileUpdate()
|
||||
@ -70,7 +70,7 @@ final class ProfileViewModelTests: XCTestCase {
|
||||
XCTAssertEqual(viewModel.displayNickname, "全局昵称")
|
||||
XCTAssertEqual(viewModel.displayAvatarURL, "https://cdn.example.com/new.jpg")
|
||||
|
||||
AppStore.shared.userName = ""
|
||||
AppStore.shared.avatar = ""
|
||||
AppStore.shared.session.userName = ""
|
||||
AppStore.shared.session.avatar = ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user