From 3200778a080d5f6e9d56b61c26787038c6a038f1 Mon Sep 17 00:00:00 2001 From: haerdib Date: Mon, 26 Feb 2024 13:24:27 +0100 Subject: [PATCH] fix test --- node-api/src/metadata/metadata_types.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/node-api/src/metadata/metadata_types.rs b/node-api/src/metadata/metadata_types.rs index c164dc049..bbef467ad 100644 --- a/node-api/src/metadata/metadata_types.rs +++ b/node-api/src/metadata/metadata_types.rs @@ -520,6 +520,7 @@ impl Metadata { mod tests { use super::*; use codec::Decode; + use scale_info::TypeDef; use sp_core::Bytes; use std::fs; @@ -531,11 +532,19 @@ mod tests { #[test] fn outer_enum_access() { let metadata = metadata(); - println!("{:?}", metadata.outer_enums().call_enum_ty); + + let call_enum_ty = metadata.outer_enums().call_enum_ty; + let ty = metadata.types().types.get(call_enum_ty.id as usize).unwrap(); + if let TypeDef::Variant(variant) = &ty.ty.type_def { + // The first pallet call is from System pallet. + assert_eq!(variant.variants[0].name, "System"); + } else { + panic!("Expetected Variant outer enum call type."); + } } #[test] - fn initial_custom_metadata_is_empty() { + fn custom_ksm_metadata_v14_is_empty() { let metadata = metadata(); let custom_metadata = metadata.custom();