cuddle/crates/cuddle-actions/tests/mod.rs
kjuulh 186f13a16c
All checks were successful
continuous-integration/drone/push Build is passing
feat: add actions sdk
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-08-26 09:05:58 +02:00

32 lines
681 B
Rust

use cuddle_actions::AddActionOptions;
use pretty_assertions::assert_eq;
#[test]
fn test_can_schema_no_actions() -> anyhow::Result<()> {
let output =
cuddle_actions::CuddleActions::default().execute_from(vec!["cuddle-actions", "schema"])?;
assert_eq!("[]", &output);
Ok(())
}
#[test]
fn test_can_schema_simple_action() -> anyhow::Result<()> {
let output = cuddle_actions::CuddleActions::default()
.add_action("something", || {}, &AddActionOptions::default())
.execute_from(vec!["cuddle-actions", "schema"])?;
assert_eq!(
r#"[
{
"name": "something",
"description": null
}
]"#,
&output
);
Ok(())
}