migration
This commit is contained in:
35
PediFoodsTests/DeepLinkRouteEffectTests.swift
Normal file
35
PediFoodsTests/DeepLinkRouteEffectTests.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
import Testing
|
||||
@testable import PediFoods
|
||||
|
||||
@Test("orderTracking destination routes to the Profile tab with a pending auto-intent order context")
|
||||
@MainActor
|
||||
func routeEffectForOrderTracking() {
|
||||
let view = ContentView()
|
||||
let effect = view.routeEffect(for: .orderTracking(orderId: "order-1", shortId: "PF-1"))
|
||||
|
||||
#expect(effect == .navigateToOrder(
|
||||
OrderRouteContext(orderId: "order-1", shortId: "PF-1", paymentMethod: nil, total: nil, intent: .auto),
|
||||
tab: .profile
|
||||
))
|
||||
}
|
||||
|
||||
@Test("orderTracking destination carries a nil shortId through unchanged")
|
||||
@MainActor
|
||||
func routeEffectForOrderTrackingWithoutShortId() {
|
||||
let view = ContentView()
|
||||
let effect = view.routeEffect(for: .orderTracking(orderId: "order-2", shortId: nil))
|
||||
|
||||
#expect(effect == .navigateToOrder(
|
||||
OrderRouteContext(orderId: "order-2", shortId: nil, paymentMethod: nil, total: nil, intent: .auto),
|
||||
tab: .profile
|
||||
))
|
||||
}
|
||||
|
||||
@Test("screen destination has no routing effect yet (unhandled deep-link screen)")
|
||||
@MainActor
|
||||
func routeEffectForScreenDestinationIsNone() {
|
||||
let view = ContentView()
|
||||
let effect = view.routeEffect(for: .screen(name: "promo", params: ["code": "SAVE10"]))
|
||||
|
||||
#expect(effect == .none)
|
||||
}
|
||||
Reference in New Issue
Block a user