Add MailRootView and related components for mail functionality
- Implement MailRootView with navigation and sidebar for mail management. - Create MailSidebarView, ThreadListView, and ThreadDetailView for displaying mail content. - Introduce ComposeView for composing new messages. - Add MailTheme for consistent styling across mail components. - Implement adaptive layouts for iOS and macOS. - Create unit tests for AppNavigationCommand and AppViewModel to ensure correct functionality.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import XCTest
|
||||
@testable import SocialIO
|
||||
|
||||
final class AppNavigationCommandTests: XCTestCase {
|
||||
func testFromEnvironmentPrefersJSONOverRoute() {
|
||||
let environment = [
|
||||
AppNavigationCommand.routeEnvironmentKey: "socialio://mailbox/inbox",
|
||||
AppNavigationCommand.jsonEnvironmentKey: #"{"kind":"compose","to":"team@social.io","subject":"Hello","body":"Hi"}"#
|
||||
]
|
||||
|
||||
let command = AppNavigationCommand.from(environment: environment)
|
||||
|
||||
XCTAssertEqual(
|
||||
command,
|
||||
.compose(draft: ComposeDraft(to: "team@social.io", subject: "Hello", body: "Hi"))
|
||||
)
|
||||
}
|
||||
|
||||
func testParseMailboxURLIncludesSearchAndUnreadOnly() {
|
||||
let command = AppNavigationCommand.parse("socialio://mailbox/starred?search=roadmap&unreadOnly=true")
|
||||
|
||||
XCTAssertEqual(
|
||||
command,
|
||||
.mailbox(mailbox: .starred, search: "roadmap", unreadOnly: true)
|
||||
)
|
||||
}
|
||||
|
||||
func testParseOpenURLMapsThreadAndMessageSelection() {
|
||||
let command = AppNavigationCommand.parse("socialio://open?thread=launch-copy&message=launch-copy-2&mailbox=sent")
|
||||
|
||||
XCTAssertEqual(
|
||||
command,
|
||||
.thread(
|
||||
threadRouteID: "launch-copy",
|
||||
mailbox: .sent,
|
||||
messageRouteID: "launch-copy-2",
|
||||
search: nil,
|
||||
unreadOnly: nil
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
func testParseJSONWithoutKindFallsBackToComposePayload() {
|
||||
let command = AppNavigationCommand.from(json: #"{"to":"grandma@example.com","subject":"Photos","body":"Hi Grandma"}"#)
|
||||
|
||||
XCTAssertEqual(
|
||||
command,
|
||||
.compose(draft: ComposeDraft(to: "grandma@example.com", subject: "Photos", body: "Hi Grandma"))
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user