
- 修改Package.swift以支持iOS 15和macOS 12。 - 更新swift-tca-architecture-guidelines.mdc中的alwaysApply设置为false。 - 注释掉AppDelegate中的NIMSDK导入,移除不再使用的NIMConfigurationManager和NIMSessionManager文件。 - 添加新的API相关文件,包括EMailLoginFeature、IDLoginFeature和相关视图,增强登录功能。 - 更新APIConstants和APIEndpoints以反映新的API路径。 - 添加本地化支持文件,包含英文和中文简体的本地化字符串。 - 新增字体管理和安全工具类,支持AES和DES加密。 - 更新Xcode项目配置,调整版本号和启动画面设置。
77 lines
2.7 KiB
Swift
77 lines
2.7 KiB
Swift
//
|
|
// yanaAPITests.swift
|
|
// yanaAPITests
|
|
//
|
|
// Created by P on 2025/5/27.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import yana
|
|
|
|
final class yanaAPITests: XCTestCase {
|
|
|
|
override func setUpWithError() throws {
|
|
// Put setup code here. This method is called before the invocation of each test method in the class.
|
|
}
|
|
|
|
override func tearDownWithError() throws {
|
|
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
|
}
|
|
|
|
func testExample() throws {
|
|
// This is an example of a functional test case.
|
|
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
// Any test you write for XCTest can be annotated as throws and async.
|
|
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
|
|
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
|
|
}
|
|
|
|
func testPerformanceExample() throws {
|
|
// This is an example of a performance test case.
|
|
measure {
|
|
// Put the code you want to measure the time of here.
|
|
}
|
|
}
|
|
|
|
func testIDLoginRequest_Creation() {
|
|
// 测试ID登录请求的创建
|
|
let userID = "399113"
|
|
let password = "a123456"
|
|
|
|
let request = LoginHelper.createIDLoginRequest(userID: userID, password: password)
|
|
XCTAssertNotNil(request, "登录请求应该创建成功")
|
|
XCTAssertEqual(request?.endpoint, "/oauth/token", "端点应该正确")
|
|
XCTAssertEqual(request?.method, .POST, "请求方法应该是POST")
|
|
}
|
|
|
|
func testIDLoginResponse_Success() {
|
|
// 测试登录响应的成功解析
|
|
let successResponse = IDLoginResponse(
|
|
status: "success",
|
|
message: "登录成功",
|
|
code: 200,
|
|
data: IDLoginData(
|
|
accessToken: "test_token",
|
|
refreshToken: "refresh_token",
|
|
tokenType: "Bearer",
|
|
expiresIn: 3600,
|
|
scope: "read write",
|
|
userInfo: UserInfo(
|
|
userId: "123",
|
|
username: "testuser",
|
|
nickname: "Test User",
|
|
avatar: nil,
|
|
email: "test@example.com",
|
|
phone: "399113",
|
|
status: "active",
|
|
createTime: "2024-01-01",
|
|
updateTime: "2024-01-01"
|
|
)
|
|
)
|
|
)
|
|
|
|
XCTAssertTrue(successResponse.isSuccess, "响应应该标记为成功")
|
|
XCTAssertEqual(successResponse.data?.accessToken, "test_token", "访问令牌应该正确")
|
|
}
|
|
}
|