修复合作获客扫码绑定崩溃与 Toast 层级,并接入分成比例修改。
将扫码页提升到列表层弹出并补齐 AppDelegate.window,避免扫码时 UIKit 取主窗口崩溃;Toast 改用独立 UIWindow 显示在 sheet 之上;合作获客员支持短信验证修改分成比例,同时优化冷启动根视图创建时机并补充相关测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
42
suixinkanTests/RootViewDisplayStateTests.swift
Normal file
42
suixinkanTests/RootViewDisplayStateTests.swift
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// RootViewDisplayStateTests.swift
|
||||
// suixinkanTests
|
||||
//
|
||||
// Created by Codex on 2026/7/3.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import suixinkan
|
||||
|
||||
/// 根视图展示状态测试,覆盖冷启动门禁与登录阶段的映射关系。
|
||||
final class RootViewDisplayStateTests: XCTestCase {
|
||||
/// 测试冷启动 bootstrap 未完成时不会提前创建登录页。
|
||||
func testBootstrapPendingLoggedOutUsesPlaceholder() {
|
||||
let state = RootContentDisplayState.resolve(
|
||||
isColdStartBootstrapPending: true,
|
||||
appPhase: .loggedOut
|
||||
)
|
||||
|
||||
XCTAssertEqual(state, .bootstrapPlaceholder)
|
||||
}
|
||||
|
||||
/// 测试 bootstrap 完成且未登录时展示登录页。
|
||||
func testBootstrapCompletedLoggedOutShowsLogin() {
|
||||
let state = RootContentDisplayState.resolve(
|
||||
isColdStartBootstrapPending: false,
|
||||
appPhase: .loggedOut
|
||||
)
|
||||
|
||||
XCTAssertEqual(state, .login)
|
||||
}
|
||||
|
||||
/// 测试 bootstrap 完成且已登录时展示主 Tab。
|
||||
func testBootstrapCompletedLoggedInShowsMainTabs() {
|
||||
let state = RootContentDisplayState.resolve(
|
||||
isColdStartBootstrapPending: false,
|
||||
appPhase: .loggedIn
|
||||
)
|
||||
|
||||
XCTAssertEqual(state, .mainTabs)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user