mirror of
https://github.com/otaviocc/Triton.git
synced 2026-01-30 04:04:27 +00:00
39 lines
1.2 KiB
Swift
39 lines
1.2 KiB
Swift
import Foundation
|
|
import Testing
|
|
@testable import Shortcuts
|
|
|
|
@Suite("CreatePasteIntent Tests")
|
|
struct CreatePasteIntentTests {
|
|
|
|
@Test("CreatePasteIntent posts correct notification")
|
|
@MainActor
|
|
func perform_withIntent_postsOpenCreatePasteWindowNotification() async throws {
|
|
// Given
|
|
let notificationCenterMock = NotificationCenterProtocolMock()
|
|
let intent = CreatePasteIntent(notificationCenter: notificationCenterMock)
|
|
|
|
// When
|
|
_ = try await intent.perform()
|
|
|
|
// Then
|
|
#expect(
|
|
notificationCenterMock.postedNotifications.count == 1,
|
|
"It should post exactly one notification"
|
|
)
|
|
|
|
#expect(
|
|
notificationCenterMock.postedNotifications.first?.name == .openCreatePasteWindow,
|
|
"It should post notification with openCreatePasteWindow name"
|
|
)
|
|
|
|
#expect(
|
|
notificationCenterMock.postedNotifications.first?.object == nil,
|
|
"It should post notification with nil object"
|
|
)
|
|
|
|
#expect(
|
|
notificationCenterMock.postedNotifications.first?.userInfo == nil,
|
|
"It should post notification with nil userInfo"
|
|
)
|
|
}
|
|
}
|