feat: add AI retouch task center
This commit is contained in:
@@ -63,6 +63,34 @@ final class PushNotificationTests: XCTestCase {
|
||||
XCTAssertEqual(nested.destination, .paymentDetails)
|
||||
}
|
||||
|
||||
func testAIRetouchPushRoutesToDetailAndFallsBackToList() {
|
||||
XCTAssertEqual(
|
||||
PushPayload(userInfo: [
|
||||
"type": 14,
|
||||
"data": ["ai_retouch_batch_id": 91, "status": "succeeded"],
|
||||
]).destination,
|
||||
.aiRetouchTaskDetail(batchId: 91)
|
||||
)
|
||||
XCTAssertEqual(
|
||||
PushPayload(userInfo: ["type": 14, "data": [:]]).destination,
|
||||
.aiRetouchTaskList
|
||||
)
|
||||
XCTAssertEqual(
|
||||
PushPayload(userInfo: ["type": 14, "data": ["ai_retouch_batch_id": "0"]]).destination,
|
||||
.aiRetouchTaskList
|
||||
)
|
||||
XCTAssertEqual(PushPayload(userInfo: ["type": 10]).destination, .messageCenter)
|
||||
}
|
||||
|
||||
func testAIRetouchPushReadsEncodedDataAndVendorWrapper() {
|
||||
let payload = PushPayload(userInfo: [
|
||||
"n_extras": #"{"type":14,"data":"{\"ai_retouch_batch_id\":92}"}"#,
|
||||
])
|
||||
|
||||
XCTAssertEqual(payload.destination, .aiRetouchTaskDetail(batchId: 92))
|
||||
XCTAssertEqual(payload.normalizedValues["ai_retouch_batch_id"], "92")
|
||||
}
|
||||
|
||||
func testPushAPIUsesAndroidCompatibleEndpointAndQuery() async throws {
|
||||
let session = MockURLSession(responses: [try TestJSON.envelope(data: EmptyPayload())])
|
||||
let api = PushAPI(client: APIClient(environment: .testing, session: session))
|
||||
|
||||
Reference in New Issue
Block a user