修复账号切换后「我的」页当前账号展示错误,并统一举报摄影师首页 URI。
切换账号时以用户选中账号为准写入展示标题与业务作用域,避免沿用旧门店名称;同时将首页举报摄影师入口 URI 对齐为 report_photographer。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -46,6 +46,32 @@ final class AccountContextTests: XCTestCase {
|
||||
XCTAssertEqual(context.currentStore?.id, 20)
|
||||
}
|
||||
|
||||
/// 测试显式切换景区账号时会清空旧门店,而不是保留上一次门店选择。
|
||||
func testReplaceScopesExplicitSelectionClearsStoreForScenicAccount() {
|
||||
let context = AccountContext()
|
||||
context.replaceScopes(
|
||||
scenic: [BusinessScope(id: 128, name: "伊犁那拉提景区-5A", kind: .scenic)],
|
||||
stores: [BusinessScope(id: 37, name: "随心旅拍", kind: .store, parentScenicId: 128)],
|
||||
currentScenicId: 128,
|
||||
currentStoreId: 37,
|
||||
explicitSelection: true
|
||||
)
|
||||
XCTAssertEqual(context.currentStore?.name, "随心旅拍")
|
||||
|
||||
context.applyLogin(accountType: V9ScenicUser.accountTypeValue, businessUserId: 41, displayTitle: "伊犁那拉提景区-5A")
|
||||
context.replaceScopes(
|
||||
scenic: [BusinessScope(id: 128, name: "伊犁那拉提景区-5A", kind: .scenic)],
|
||||
stores: [BusinessScope(id: 37, name: "随心旅拍", kind: .store, parentScenicId: 128)],
|
||||
currentScenicId: 128,
|
||||
currentStoreId: nil,
|
||||
explicitSelection: true
|
||||
)
|
||||
|
||||
XCTAssertEqual(context.accountType, V9ScenicUser.accountTypeValue)
|
||||
XCTAssertNil(context.currentStore)
|
||||
XCTAssertEqual(context.currentAccountDisplayTitle, "伊犁那拉提景区-5A")
|
||||
}
|
||||
|
||||
/// 测试缓存 ID 不存在时会回退到首个可用作用域。
|
||||
func testReplaceScopesFallsBackToFirstScopeWhenCachedIdIsMissing() {
|
||||
let context = AccountContext()
|
||||
|
||||
Reference in New Issue
Block a user