diff --git a/sputnikdao-factory2/src/lib.rs b/sputnikdao-factory2/src/lib.rs index f87135911..5bd4977aa 100644 --- a/sputnikdao-factory2/src/lib.rs +++ b/sputnikdao-factory2/src/lib.rs @@ -394,6 +394,7 @@ pub extern "C" fn store() { #[cfg(test)] mod tests { + use near_sdk::test_utils::test_env::alice; use near_sdk::test_utils::{accounts, VMContextBuilder}; use near_sdk::{testing_env, PromiseResult}; @@ -432,4 +433,22 @@ mod tests { vec![format!("test.{}", accounts(0)).parse().unwrap()] ); } + + #[test] + fn test_factory_can_get_current_owner() { + let mut context = VMContextBuilder::new(); + testing_env!(context + .current_account_id(accounts(0)) + .predecessor_account_id(accounts(0)) + .attached_deposit(10) + .build()); + let mut factory = SputnikDAOFactory::new(); + + factory.create(alice(), "{}".as_bytes().to_vec().into()); + + assert_eq!( + factory.get_owner().to_string(), + alice().to_string().strip_suffix(".near").unwrap() + ); + } }