blvm-node 0.1.2

Bitcoin Commons BLVM: Minimal Bitcoin node implementation using blvm-protocol and blvm-consensus
//! Signal handling utility tests
//!
//! Tests for signal handling functions.

use blvm_node::utils::signal::create_shutdown_receiver;

#[tokio::test]
async fn test_create_shutdown_receiver() {
    // Test that shutdown receiver can be created
    let receiver = create_shutdown_receiver();

    // Receiver should be created successfully
    assert!(!*receiver.borrow());

    // Note: We can't easily test actual signal handling without sending signals,
    // but we can verify the receiver is functional
}

#[tokio::test]
async fn test_shutdown_receiver_initial_state() {
    let receiver = create_shutdown_receiver();

    // Initially should be false (not shutdown)
    assert!(!*receiver.borrow());
}

// Note: Testing actual signal delivery (SIGTERM, SIGINT) is difficult in unit tests
// as it requires process-level signal handling. These tests verify the receiver
// can be created and has the correct initial state.