Skip to main content

codama_nodes/contextual_value_nodes/
account_bump_value_node.rs

1use crate::{AccountBumpValueNode, CamelCaseString};
2
3impl AccountBumpValueNode {
4    pub fn new<T>(name: T) -> Self
5    where
6        T: Into<CamelCaseString>,
7    {
8        Self { name: name.into() }
9    }
10}
11
12#[cfg(test)]
13mod tests {
14    use super::*;
15
16    #[test]
17    fn new() {
18        let node = AccountBumpValueNode::new("my_account");
19        assert_eq!(node.name, CamelCaseString::new("myAccount"));
20    }
21
22    #[test]
23    fn to_json() {
24        let node = AccountBumpValueNode::new("myAccount");
25        let json = serde_json::to_string(&node).unwrap();
26        assert_eq!(
27            json,
28            r#"{"kind":"accountBumpValueNode","name":"myAccount"}"#
29        );
30    }
31
32    #[test]
33    fn from_json() {
34        let json = r#"{"kind":"accountBumpValueNode","name":"myAccount"}"#;
35        let node: AccountBumpValueNode = serde_json::from_str(json).unwrap();
36        assert_eq!(node, AccountBumpValueNode::new("myAccount"));
37    }
38}