mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
40 lines
1.9 KiB
Swift
40 lines
1.9 KiB
Swift
//
|
|
// Copyright 2025 Element Creations Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import MatrixRustSDK
|
|
import XCTest
|
|
|
|
@testable import ElementX
|
|
|
|
final class NotificationContentBuilderTests: XCTestCase {
|
|
var notificationContentBuilder: NotificationContentBuilder!
|
|
var mediaProvider: MediaProviderMock!
|
|
|
|
override func setUp() {
|
|
let stringBuilder = RoomMessageEventStringBuilder(attributedStringBuilder: AttributedStringBuilder(mentionBuilder: PlainMentionBuilder()),
|
|
destination: .notification)
|
|
mediaProvider = MediaProviderMock(configuration: .init())
|
|
notificationContentBuilder = NotificationContentBuilder(messageEventStringBuilder: stringBuilder,
|
|
userSession: NSEUserSessionMock(.init()))
|
|
}
|
|
|
|
func testDMMessageNotification() async {
|
|
let notificationItem = NotificationItemProxyMock(.init(senderDisplayName: "Alice",
|
|
roomDisplayName: "Alice",
|
|
roomJoinedMembers: 2,
|
|
isRoomDirect: true,
|
|
isRoomPrivate: true))
|
|
var notificationContent = UNMutableNotificationContent()
|
|
await notificationContentBuilder.process(notificationContent: ¬ificationContent,
|
|
notificationItem: notificationItem,
|
|
mediaProvider: mediaProvider)
|
|
|
|
XCTAssertEqual(notificationContent.title, "Alice")
|
|
XCTAssertEqual(notificationContent.body, "Hello world!")
|
|
}
|
|
}
|