将扫码页提升到列表层弹出并补齐 AppDelegate.window,避免扫码时 UIKit 取主窗口崩溃;Toast 改用独立 UIWindow 显示在 sheet 之上;合作获客员支持短信验证修改分成比例,同时优化冷启动根视图创建时机并补充相关测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.2 KiB
Swift
43 lines
1.2 KiB
Swift
//
|
||
// 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)
|
||
}
|
||
}
|