@@ -5,16 +5,33 @@ mod inherent_provider {
5
5
use super :: runtime_api_mock:: * ;
6
6
use crate :: inherent_provider:: mock:: * ;
7
7
use crate :: inherent_provider:: * ;
8
- use crate :: MainChainScripts ;
9
- use crate :: INHERENT_IDENTIFIER ;
8
+ use crate :: { InherentError , MainChainScripts , INHERENT_IDENTIFIER } ;
10
9
use sidechain_domain:: * ;
11
10
use sidechain_mc_hash:: MC_HASH_DIGEST_ID ;
12
- use sp_inherents:: InherentData ;
13
- use sp_inherents:: InherentDataProvider ;
14
- use sp_runtime:: testing:: Digest ;
15
- use sp_runtime:: testing:: DigestItem ;
11
+ use sp_inherents:: { InherentData , InherentDataProvider } ;
12
+ use sp_runtime:: testing:: { Digest , DigestItem } ;
16
13
use std:: sync:: Arc ;
17
14
15
+ #[ test]
16
+ fn error_message_formatting ( ) {
17
+ assert_eq ! (
18
+ InherentError :: TokenTransferNotHandled ( NativeTokenAmount ( 3u128 ) ) . to_string( ) ,
19
+ "Inherent missing for token transfer of 3 tokens"
20
+ ) ;
21
+ assert_eq ! (
22
+ InherentError :: IncorrectTokenNumberTransfered (
23
+ NativeTokenAmount ( 13u128 ) ,
24
+ NativeTokenAmount ( 7u128 )
25
+ )
26
+ . to_string( ) ,
27
+ "Incorrect token transfer amount: expected 13, got 7 tokens"
28
+ ) ;
29
+ assert_eq ! (
30
+ InherentError :: UnexpectedTokenTransferInherent ( NativeTokenAmount ( 13u128 ) ) . to_string( ) ,
31
+ "Unexpected transfer of 13 tokens"
32
+ ) ;
33
+ }
34
+
18
35
#[ tokio:: test]
19
36
async fn correctly_fetches_total_transfer_between_two_hashes ( ) {
20
37
let parent_number = 1 ; // not genesis
0 commit comments