liminal-server 0.25.4

Standalone server for the liminal messaging bus
Documentation
//! An outright act's receipt names the grant and Lys, never a person who did not see the act.

use super::super::test_support::{Fixture, TestResult, pass, spec};
use super::super::{SiteAct, SiteChange};

#[test]
fn an_outright_site_names_its_grant_and_lys_and_keeps_its_answerable_person() -> TestResult {
    let fixture = Fixture::new()?;
    let act = SiteAct::prepare(
        "echo".into(),
        SiteChange::CreateSite(spec()),
        &pass("builder", "agent")?,
    )?;
    let answer = fixture
        .lifecycle
        .apply_outright(&act, "grant-outright", "op-1", "words", 40)?;
    assert_eq!(answer["approved_by"], "lys");
    assert_eq!(answer["responsible"], "person-owner");
    let record = fixture.lifecycle.record("echo")?;
    assert_eq!(record.approved_by, ["lys"]);
    assert_eq!(record.responsible.as_deref(), Some("person-owner"));
    let receipt = record.approvals.first().ok_or("no receipt")?;
    assert_eq!(receipt.draft, "grant:grant-outright");
    assert_eq!(receipt.approved_by, ["lys"]);
    Ok(())
}