mod common;
use common::{init_project, normalize_output, run_commands, today};
#[test]
fn test_describe_basic() -> common::TestResult {
let temp_dir = tempfile::TempDir::new()?;
let date = today();
let output = run_commands(temp_dir.path(), &[&["describe"]])?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_in_initialized_project() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(temp_dir.path(), &[&["describe"]])?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_with_context_empty_project() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(temp_dir.path(), &[&["describe", "--context"]])?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_with_context_draft_rfc() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(
temp_dir.path(),
&[&["rfc", "new", "Test RFC"], &["describe", "--context"]],
)?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_with_context_normative_spec_phase_rfc() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(
temp_dir.path(),
&[
&["rfc", "new", "Test RFC"],
&["rfc", "finalize", "RFC-0001", "normative"],
&["describe", "--context"],
],
)?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_with_context_normative_impl_phase_rfc() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(
temp_dir.path(),
&[
&["rfc", "new", "Test RFC"],
&["rfc", "finalize", "RFC-0001", "normative"],
&["rfc", "advance", "RFC-0001", "impl"],
&["describe", "--context"],
],
)?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_with_context_normative_test_phase_rfc() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(
temp_dir.path(),
&[
&["rfc", "new", "Test RFC"],
&["rfc", "finalize", "RFC-0001", "normative"],
&["rfc", "advance", "RFC-0001", "impl"],
&["rfc", "advance", "RFC-0001", "test"],
&["describe", "--context"],
],
)?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_with_context_proposed_adr() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(
temp_dir.path(),
&[&["adr", "new", "Test Decision"], &["describe", "--context"]],
)?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_with_context_active_work_item() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(
temp_dir.path(),
&[
&["work", "new", "Test task", "--active"],
&["describe", "--context"],
],
)?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}
#[test]
fn test_describe_with_context_queued_work_items() -> common::TestResult {
let temp_dir = init_project()?;
let date = today();
let output = run_commands(
temp_dir.path(),
&[
&["work", "new", "Task one"],
&["work", "new", "Task two"],
&["describe", "--context"],
],
)?;
insta::assert_snapshot!(normalize_output(&output, temp_dir.path(), &date)?);
Ok(())
}