Skip to content

Commit

Permalink
fix the testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
hp77-creator committed Sep 16, 2024
1 parent d51b425 commit 451dfaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions pallets/node-authorization/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ pub mod pallet {
}

#[pallet::error]
#[derive(PartialEq)]
pub enum Error<T> {
/// The Node identifier is too long.
NodeIdTooLong,
Expand Down
9 changes: 8 additions & 1 deletion pallets/node-authorization/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

use super::*;
use crate::mock::*;
use frame_support::{assert_noop, assert_ok};
use frame_support::{assert_noop, assert_ok, assert_err};
use sp_runtime::traits::BadOrigin;

#[test]
Expand Down Expand Up @@ -453,3 +453,10 @@ fn adding_already_connected_connection_should_fail() {
);
});
}

#[test]
fn test_generate_peer_id_invalid_utf8() {
let invalid_node_id: NodeId = vec![0xFF, 0xFE, 0xFD];
let result = Pallet::<Test>::generate_peer_id(&invalid_node_id);
assert_noop!(result, Error::<Test>::InvalidUtf8);
}

0 comments on commit 451dfaf

Please sign in to comment.