Skip to main content

rskit_testutil/
hook.rs

1//! Hook test helpers.
2
3use rskit_hook::{Event, EventType};
4
5/// Simple typed event for hook and event-bus tests.
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub struct TestEvent {
8    /// Stable event type name.
9    pub event_type: EventType,
10    /// Human-readable payload.
11    pub message: String,
12}
13
14impl TestEvent {
15    /// Create a test event.
16    #[must_use]
17    pub fn new(event_type: impl Into<String>, message: impl Into<String>) -> Self {
18        Self {
19            event_type: EventType::new(event_type),
20            message: message.into(),
21        }
22    }
23}
24
25impl Event for TestEvent {
26    fn event_type(&self) -> EventType {
27        self.event_type.clone()
28    }
29}