-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
666 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
use crate::{mock::*, Error, Event, Something}; | ||
use frame_support::{assert_noop, assert_ok}; | ||
use pallet_support::Content; | ||
|
||
#[test] | ||
fn it_works_for_default_value() { | ||
fn create_department_works() { | ||
new_test_ext().execute_with(|| { | ||
// Go past genesis block so events get deposited | ||
// // Go past genesis block so events get deposited | ||
System::set_block_number(1); | ||
}); | ||
} | ||
let account_id = 1; | ||
let content: Content = Content::IPFS( | ||
"bafkreiaiq24be2iioasr6ftyaum3icmj7amtjkom2jeokov5k5ojwzhvqy" | ||
.as_bytes() | ||
.to_vec(), | ||
); | ||
assert_ok!(Departments::create_department( | ||
RuntimeOrigin::signed(account_id), | ||
content.clone() | ||
)); | ||
|
||
#[test] | ||
fn correct_error_for_none_value() { | ||
new_test_ext().execute_with(|| {}); | ||
// Check that the department was stored correctly | ||
let department_id = Departments::next_department_id() - 1; | ||
let stored_department = Departments::departments(department_id).unwrap(); | ||
assert_eq!(stored_department.department_id, department_id); | ||
assert_eq!(stored_department.content, content); | ||
assert_eq!(stored_department.department_admin, account_id); | ||
|
||
// Verify that the correct event was emitted | ||
System::assert_last_event( | ||
Event::DepartmentCreated { account: account_id, department_id }.into(), | ||
); | ||
}); | ||
} |
Oops, something went wrong.