()
| 626 | |
| 627 | #[tokio::test] |
| 628 | async fn test_engine_fire_priority_order() { |
| 629 | let engine = HookEngine::new(); |
| 630 | |
| 631 | // Register two hooks, lower priority one blocks |
| 632 | engine.register( |
| 633 | Hook::new("block-hook", HookEventType::PreToolUse).with_config(HookConfig { |
| 634 | priority: 5, // Higher priority (executes first) |
| 635 | ..Default::default() |
| 636 | }), |
| 637 | ); |
| 638 | engine.register( |
| 639 | Hook::new("continue-hook", HookEventType::PreToolUse).with_config(HookConfig { |
| 640 | priority: 10, |
| 641 | ..Default::default() |
| 642 | }), |
| 643 | ); |
| 644 | |
| 645 | engine.register_handler( |
| 646 | "block-hook", |
| 647 | Arc::new(BlockHandler { |
| 648 | reason: "Blocked first".to_string(), |
| 649 | }), |
| 650 | ); |
| 651 | engine.register_handler("continue-hook", Arc::new(ContinueHandler)); |
| 652 | |
| 653 | let event = make_pre_tool_event("s1", "Bash"); |
| 654 | let result = engine.fire(&event).await; |
| 655 | |
| 656 | // block-hook executes first, should block |
| 657 | assert!(result.is_block()); |
| 658 | } |
| 659 | |
| 660 | #[test] |
| 661 | fn test_hook_serialization() { |
nothing calls this directly
no test coverage detected