Files
hapi/ios/HapiTests/MessageChromeTests.swift
T
b1c69f7219 feat(ios): enhance the session detail and list UI
- Add a live session status line and project/model/effort metadata to the chat header, plus a compact composer strip for model, effort, permission and connection state.
- Add per-message timestamps, copy, and duration/model/token details; switch user bubbles to a neutral surface, card the reasoning block, and timestamp event rows.
- Surface tool start/duration in summary cards and give list agent icons a native surface tile while preserving grouping and row metrics.

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-07 22:35:08 +08:00

32 lines
1.0 KiB
Swift

import HapiProtocol
import XCTest
@testable import Hapi
final class MessageChromeTests: XCTestCase {
func testDurationLabels() {
XCTAssertEqual(ChatDurationLabel.text(ms: 500), "0.5s")
XCTAssertEqual(ChatDurationLabel.text(ms: 8_500), "8.5s")
XCTAssertEqual(ChatDurationLabel.text(ms: 65_000), "1m 5s")
XCTAssertNil(ChatDurationLabel.text(ms: 0))
}
func testMessageMetadataUsesUsage() {
let meta = ChatMessageMeta(
durationMs: 8_500,
model: "claude-sonnet",
usage: UsageData(inputTokens: 120, outputTokens: 45)
)
XCTAssertTrue(meta.hasDetails)
XCTAssertEqual(meta.durationLabel, "8.5s")
XCTAssertEqual(meta.model, "claude-sonnet")
XCTAssertEqual(meta.tokenLabel, "120 / 45")
}
func testEmptyMetadataHidesTheInfoAction() {
XCTAssertFalse(ChatMessageMeta().hasDetails)
XCTAssertNil(ChatMessageMeta().durationLabel)
XCTAssertNil(ChatMessageMeta().tokenLabel)
}
}