use super::debug_contracts::LoggingSchemaDebugReport;
use super::debug_service_error::LoggingSchemaDebugReportError;
use super::debug_service_result_stage_contracts::LoggingSchemaDebugReportServiceResultStage;
use super::debug_service_result_stage_test_helpers::{
build_fetch_columns_service_result_stage_for_tests,
build_fetch_relations_service_result_stage_for_tests,
build_successful_service_result_stage_for_tests,
};
use super::debug_service_result_test_helpers::{
assert_fetch_snapshot_columns_service_error_for_tests,
assert_fetch_snapshot_relations_service_error_for_tests,
assert_successful_service_report_result_for_tests,
};
#[cfg(test)]
pub(crate) type LoggingSchemaDebugReportServiceResultStageHandoffFn =
fn(
LoggingSchemaDebugReportServiceResultStage,
) -> Result<LoggingSchemaDebugReport, LoggingSchemaDebugReportError>;
#[cfg(test)]
pub(crate) fn assert_service_result_stage_handoff_preserves_success_for_tests(
handoff: LoggingSchemaDebugReportServiceResultStageHandoffFn,
context: &str,
) {
let result = handoff(build_successful_service_result_stage_for_tests());
assert_successful_service_report_result_for_tests(result, context);
}
#[cfg(test)]
pub(crate) fn assert_service_result_stage_handoff_maps_columns_error_for_tests(
handoff: LoggingSchemaDebugReportServiceResultStageHandoffFn,
source_message: &str,
expected_source_fragment: Option<&str>,
context: &str,
) {
let result = handoff(build_fetch_columns_service_result_stage_for_tests(
source_message,
));
assert_fetch_snapshot_columns_service_error_for_tests(
result,
expected_source_fragment,
context,
);
}
#[cfg(test)]
pub(crate) fn assert_service_result_stage_handoff_maps_relations_error_for_tests(
handoff: LoggingSchemaDebugReportServiceResultStageHandoffFn,
source_message: &str,
expected_source_fragment: Option<&str>,
context: &str,
) {
let result = handoff(build_fetch_relations_service_result_stage_for_tests(
source_message,
));
assert_fetch_snapshot_relations_service_error_for_tests(
result,
expected_source_fragment,
context,
);
}