#[tokio::test]
async fn test_hooks_install() {
let cmd = HooksCommands::Install {
interactive: false,
force: false,
backup: true,
tdg_enforcement: false,
stack: false,
update: false,
};
let result = handle_hooks_command(&cmd).await;
let _ = result;
}
#[tokio::test]
async fn test_hooks_status() {
let cmd = HooksCommands::Status {
stack: false,
format: crate::cli::enums::OutputFormat::Table,
};
let result = handle_hooks_command(&cmd).await;
let _ = result;
}
#[tokio::test]
async fn test_hooks_verify() {
let cmd = HooksCommands::Verify { fix: false };
let result = handle_hooks_command(&cmd).await;
let _ = result;
}
#[test]
fn test_normalize_hook_content_removes_timestamp() {
let content_with_timestamp = r#"#!/bin/bash
# Generated pre-commit hook (auto-managed by PMAT)
# DO NOT EDIT: This file is automatically generated
# Generated at: 2025-10-06 12:04:56
set -e
echo "Running hooks...""#;
let content_with_different_timestamp = r#"#!/bin/bash
# Generated pre-commit hook (auto-managed by PMAT)
# DO NOT EDIT: This file is automatically generated
# Generated at: 2025-10-06 14:30:22
set -e
echo "Running hooks...""#;
let normalized1 = HooksCommand::normalize_hook_content(content_with_timestamp);
let normalized2 = HooksCommand::normalize_hook_content(content_with_different_timestamp);
assert_eq!(normalized1, normalized2);
assert!(!normalized1.contains("Generated at:"));
assert!(!normalized2.contains("Generated at:"));
}
#[test]
fn test_normalize_hook_content_preserves_other_content() {
let content = r#"#!/bin/bash
# Some comment
# Generated at: 2025-10-06 12:00:00
echo "test"
pmat analyze complexity"#;
let normalized = HooksCommand::normalize_hook_content(content);
assert!(normalized.contains("#!/bin/bash"));
assert!(normalized.contains("# Some comment"));
assert!(normalized.contains("echo \"test\""));
assert!(normalized.contains("pmat analyze complexity"));
assert!(!normalized.contains("Generated at:"));
}
mod property_tests {
use proptest::prelude::*;
proptest! {
#[test]
fn basic_property_stability(_input in ".*") {
prop_assert!(true);
}
#[test]
fn module_consistency_check(_x in 0u32..1000) {
prop_assert!(_x < 1001);
}
}
}