Skip to content

Commit

Permalink
increase coverage of ddc-nodes to 90% (#175)
Browse files Browse the repository at this point in the history
Co-authored-by: aie0 <149175774+aie0@users.noreply.github.com>
  • Loading branch information
Raid5594 and aie0 authored Dec 1, 2023
1 parent 77bf8a3 commit b4c80f7
Show file tree
Hide file tree
Showing 5 changed files with 402 additions and 5 deletions.
6 changes: 6 additions & 0 deletions pallets/ddc-nodes/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ benchmarks! {
p2p_port: 65000u16,
});
}

impl_benchmark_test_suite!(
DdcNodes,
crate::mock::ExtBuilder.build(),
crate::mock::Test,
);
}
1 change: 1 addition & 0 deletions pallets/ddc-nodes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ pub mod pallet {
fn delete(node_pub_key: NodePubKey) -> Result<(), NodeRepositoryError>;
}

#[derive(Debug, PartialEq)]
pub enum NodeRepositoryError {
StorageNodeAlreadyExists,
CDNNodeAlreadyExists,
Expand Down
2 changes: 1 addition & 1 deletion pallets/ddc-nodes/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub(crate) type TestRuntimeCall = <Test as frame_system::Config>::RuntimeCall;
pub struct ExtBuilder;

impl ExtBuilder {
fn build(self) -> TestExternalities {
pub fn build(self) -> TestExternalities {
sp_tracing::try_init_simple();
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();

Expand Down
1 change: 1 addition & 0 deletions pallets/ddc-nodes/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ impl<T: frame_system::Config> NodeTrait<T> for Node<T> {
}
}

#[derive(Debug, PartialEq)]
pub enum NodeError {
InvalidStorageNodePubKey,
InvalidCDNNodePubKey,
Expand Down
Loading

0 comments on commit b4c80f7

Please sign in to comment.